DatabaseInstanceFromSnapshot
- class aws_cdk.aws_rds.DatabaseInstanceFromSnapshot(scope, id, *, snapshot_identifier, credentials=None, engine, allocated_storage=None, allow_major_version_upgrade=None, database_name=None, instance_type=None, license_model=None, parameters=None, timezone=None, vpc, auto_minor_version_upgrade=None, availability_zone=None, backup_retention=None, ca_certificate=None, cloudwatch_logs_exports=None, cloudwatch_logs_retention=None, cloudwatch_logs_retention_role=None, copy_tags_to_snapshot=None, delete_automated_backups=None, deletion_protection=None, domain=None, domain_role=None, enable_performance_insights=None, iam_authentication=None, instance_identifier=None, iops=None, max_allocated_storage=None, monitoring_interval=None, monitoring_role=None, multi_az=None, network_type=None, option_group=None, parameter_group=None, performance_insight_encryption_key=None, performance_insight_retention=None, port=None, preferred_backup_window=None, preferred_maintenance_window=None, processor_features=None, publicly_accessible=None, removal_policy=None, s3_export_buckets=None, s3_export_role=None, s3_import_buckets=None, s3_import_role=None, security_groups=None, storage_throughput=None, storage_type=None, subnet_group=None, vpc_subnets=None)
Bases:
DatabaseInstanceBase
A database instance restored from a snapshot.
- Resource:
AWS::RDS::DBInstance
- ExampleMetadata:
infused
Example:
# vpc: ec2.Vpc # source_instance: rds.DatabaseInstance rds.DatabaseInstanceFromSnapshot(self, "Instance", snapshot_identifier="my-snapshot", engine=rds.DatabaseInstanceEngine.postgres(version=rds.PostgresEngineVersion.VER_16_3), # optional, defaults to m5.large instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), vpc=vpc ) rds.DatabaseInstanceReadReplica(self, "ReadReplica", source_database_instance=source_instance, instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), vpc=vpc )
- Parameters:
scope (
Construct
) –id (
str
) –snapshot_identifier (
str
) – The name or Amazon Resource Name (ARN) of the DB snapshot that’s used to restore the DB instance. If you’re restoring from a shared manual DB snapshot, you must specify the ARN of the snapshot.credentials (
Optional
[SnapshotCredentials
]) – Master user credentials. Note - It is not possible to change the master username for a snapshot; however, it is possible to provide (or generate) a new password. Default: - The existing username and password from the snapshot will be used.engine (
IInstanceEngine
) – The database engine.allocated_storage (
Union
[int
,float
,None
]) – The allocated storage size, specified in gibibytes (GiB). Default: 100allow_major_version_upgrade (
Optional
[bool
]) – Whether to allow major version upgrades. Default: falsedatabase_name (
Optional
[str
]) – The name of the database. Default: - no nameinstance_type (
Optional
[InstanceType
]) – The name of the compute and memory capacity for the instance. Default: - m5.large (or, more specifically, db.m5.large)license_model (
Optional
[LicenseModel
]) – The license model. Default: - RDS default license modelparameters (
Optional
[Mapping
[str
,str
]]) – The parameters in the DBParameterGroup to create automatically. You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBParameterGroup. Default: - Nonetimezone (
Optional
[str
]) – The time zone of the instance. This is currently supported only by Microsoft Sql Server. Default: - RDS default timezonevpc (
IVpc
) – The VPC network where the DB subnet group should be created.auto_minor_version_upgrade (
Optional
[bool
]) – Indicates that minor engine upgrades are applied automatically to the DB instance during the maintenance window. Default: trueavailability_zone (
Optional
[str
]) – The name of the Availability Zone where the DB instance will be located. Default: - no preferencebackup_retention (
Optional
[Duration
]) – The number of days during which automatic DB snapshots are retained. Set to zero to disable backups. When creating a read replica, you must enable automatic backups on the source database instance by setting the backup retention to a value other than zero. Default: - Duration.days(1) for source instances, disabled for read replicasca_certificate (
Optional
[CaCertificate
]) – The identifier of the CA certificate for this DB instance. Specifying or updating this property triggers a reboot. For RDS DB engines: Default: - RDS will choose a certificate authoritycloudwatch_logs_exports (
Optional
[Sequence
[str
]]) – The list of log types that need to be enabled for exporting to CloudWatch Logs. Default: - no log exportscloudwatch_logs_retention (
Optional
[RetentionDays
]) – The number of days log events are kept in CloudWatch Logs. When updating this property, unsetting it doesn’t remove the log retention policy. To remove the retention policy, set the value toInfinity
. Default: - logs never expirecloudwatch_logs_retention_role (
Optional
[IRole
]) – The IAM role for the Lambda function associated with the custom resource that sets the retention policy. Default: - a new role is created.copy_tags_to_snapshot (
Optional
[bool
]) – Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance. Default: truedelete_automated_backups (
Optional
[bool
]) – Indicates whether automated backups should be deleted or retained when you delete a DB instance. Default: truedeletion_protection (
Optional
[bool
]) – Indicates whether the DB instance should have deletion protection enabled. Default: - true ifremovalPolicy
is RETAIN, false otherwisedomain (
Optional
[str
]) – The Active Directory directory ID to create the DB instance in. Default: - Do not join domaindomain_role (
Optional
[IRole
]) – The IAM role to be used when making API calls to the Directory Service. The role needs the AWS-managed policy AmazonRDSDirectoryServiceAccess or equivalent. Default: - The role will be created for you ifDatabaseInstanceNewProps#domain
is specifiedenable_performance_insights (
Optional
[bool
]) – Whether to enable Performance Insights for the DB instance. Default: - false, unlessperformanceInsightRetention
orperformanceInsightEncryptionKey
is set.iam_authentication (
Optional
[bool
]) – Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. Default: falseinstance_identifier (
Optional
[str
]) – A name for the DB instance. If you specify a name, AWS CloudFormation converts it to lowercase. Default: - a CloudFormation generated nameiops (
Union
[int
,float
,None
]) – The number of I/O operations per second (IOPS) that the database provisions. The value must be equal to or greater than 1000. Default: - no provisioned iops if storage type is not specified. For GP3: 3,000 IOPS if allocated storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, less than 200 GiB for Oracle and less than 20 GiB for SQL Server. 12,000 IOPS otherwise (except for SQL Server where the default is always 3,000 IOPS).max_allocated_storage (
Union
[int
,float
,None
]) – Upper limit to which RDS can scale the storage in GiB(Gibibyte). Default: - No autoscaling of RDS instancemonitoring_interval (
Optional
[Duration
]) – The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instance. Default: - no enhanced monitoringmonitoring_role (
Optional
[IRole
]) – Role that will be used to manage DB instance monitoring. Default: - A role is automatically created for youmulti_az (
Optional
[bool
]) – Specifies if the database instance is a multiple Availability Zone deployment. Default: falsenetwork_type (
Optional
[NetworkType
]) – The network type of the DB instance. Default: - IPV4option_group (
Optional
[IOptionGroup
]) – The option group to associate with the instance. Default: - no option groupparameter_group (
Optional
[IParameterGroup
]) – The DB parameter group to associate with the instance. Default: - no parameter groupperformance_insight_encryption_key (
Optional
[IKey
]) – The AWS KMS key for encryption of Performance Insights data. Default: - default master keyperformance_insight_retention (
Optional
[PerformanceInsightRetention
]) – The amount of time, in days, to retain Performance Insights data. Default: 7 this is the free tierport (
Union
[int
,float
,None
]) – The port for the instance. Default: - the default port for the chosen engine.preferred_backup_window (
Optional
[str
]) – The daily time range during which automated backups are performed. Constraints: - Must be in the formathh24:mi-hh24:mi
. - Must be in Universal Coordinated Time (UTC). - Must not conflict with the preferred maintenance window. - Must be at least 30 minutes. Default: - a 30-minute window selected at random from an 8-hour block of time for each AWS Region. To see the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindowpreferred_maintenance_window (
Optional
[str
]) – The weekly time range (in UTC) during which system maintenance can occur. Format:ddd:hh24:mi-ddd:hh24:mi
Constraint: Minimum 30-minute window Default: - a 30-minute window selected at random from an 8-hour block of time for each AWS Region, occurring on a random day of the week. To see the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenanceprocessor_features (
Union
[ProcessorFeatures
,Dict
[str
,Any
],None
]) – The number of CPU cores and the number of threads per core. Default: - the default number of CPU cores and threads per core for the chosen instance class. See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#USER_ConfigureProcessorpublicly_accessible (
Optional
[bool
]) – Indicates whether the DB instance is an internet-facing instance. If not specified, the instance’s vpcSubnets will be used to determine if the instance is internet-facing or not. Default: -true
if the instance’svpcSubnets
issubnetType: SubnetType.PUBLIC
,false
otherwiseremoval_policy (
Optional
[RemovalPolicy
]) – The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update. Default: - RemovalPolicy.SNAPSHOT (remove the resource, but retain a snapshot of the data)s3_export_buckets (
Optional
[Sequence
[IBucket
]]) – S3 buckets that you want to load data into. This property must not be used ifs3ExportRole
is used. For Microsoft SQL Server: Default: - Nones3_export_role (
Optional
[IRole
]) – Role that will be associated with this DB instance to enable S3 export. This property must not be used ifs3ExportBuckets
is used. For Microsoft SQL Server: Default: - New role is created ifs3ExportBuckets
is set, no role is defined otherwises3_import_buckets (
Optional
[Sequence
[IBucket
]]) – S3 buckets that you want to load data from. This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. This property must not be used ifs3ImportRole
is used. For Microsoft SQL Server: Default: - Nones3_import_role (
Optional
[IRole
]) – Role that will be associated with this DB instance to enable S3 import. This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. This property must not be used ifs3ImportBuckets
is used. For Microsoft SQL Server: Default: - New role is created ifs3ImportBuckets
is set, no role is defined otherwisesecurity_groups (
Optional
[Sequence
[ISecurityGroup
]]) – The security groups to assign to the DB instance. Default: - a new security group is createdstorage_throughput (
Union
[int
,float
,None
]) – The storage throughput, specified in mebibytes per second (MiBps). Only applicable for GP3. Default: - 125 MiBps if allocated storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, less than 200 GiB for Oracle and less than 20 GiB for SQL Server. 500 MiBps otherwise (except for SQL Server where the default is always 125 MiBps).storage_type (
Optional
[StorageType
]) – The storage type. Storage types supported are gp2, io1, standard. Default: GP2subnet_group (
Optional
[ISubnetGroup
]) – Existing subnet group for the instance. Default: - a new subnet group will be created.vpc_subnets (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – The type of subnets to add to the created DB subnet group. Default: - private subnets
Methods
- add_proxy(id, *, secrets, vpc, borrow_timeout=None, client_password_auth_type=None, db_proxy_name=None, debug_logging=None, iam_auth=None, idle_client_timeout=None, init_query=None, max_connections_percent=None, max_idle_connections_percent=None, require_tls=None, role=None, security_groups=None, session_pinning_filters=None, vpc_subnets=None)
Add a new db proxy to this instance.
- Parameters:
id (
str
) –secrets (
Sequence
[ISecret
]) – The secret that the proxy uses to authenticate to the RDS DB instance or Aurora DB cluster. These secrets are stored within Amazon Secrets Manager. One or more secrets are required.vpc (
IVpc
) – The VPC to associate with the new proxy.borrow_timeout (
Optional
[Duration
]) – The duration for a proxy to wait for a connection to become available in the connection pool. Only applies when the proxy has opened its maximum number of connections and all connections are busy with client sessions. Value must be between 1 second and 1 hour, orDuration.seconds(0)
to represent unlimited. Default: cdk.Duration.seconds(120)client_password_auth_type (
Optional
[ClientPasswordAuthType
]) – Specifies the details of authentication used by a proxy to log in as a specific database user. Default: - CloudFormation defaults will apply given the specified database engine.db_proxy_name (
Optional
[str
]) – The identifier for the proxy. This name must be unique for all proxies owned by your AWS account in the specified AWS Region. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can’t end with a hyphen or contain two consecutive hyphens. Default: - Generated by CloudFormation (recommended)debug_logging (
Optional
[bool
]) – Whether the proxy includes detailed information about SQL statements in its logs. This information helps you to debug issues involving SQL behavior or the performance and scalability of the proxy connections. The debug information includes the text of SQL statements that you submit through the proxy. Thus, only enable this setting when needed for debugging, and only when you have security measures in place to safeguard any sensitive information that appears in the logs. Default: falseiam_auth (
Optional
[bool
]) – Whether to require or disallow AWS Identity and Access Management (IAM) authentication for connections to the proxy. Default: falseidle_client_timeout (
Optional
[Duration
]) – The number of seconds that a connection to the proxy can be inactive before the proxy disconnects it. You can set this value higher or lower than the connection timeout limit for the associated database. Default: cdk.Duration.minutes(30)init_query (
Optional
[str
]) – One or more SQL statements for the proxy to run when opening each new database connection. Typically used with SET statements to make sure that each connection has identical settings such as time zone and character set. For multiple statements, use semicolons as the separator. You can also include multiple variables in a single SET statement, such as SET x=1, y=2. not currently supported for PostgreSQL. Default: - no initialization querymax_connections_percent (
Union
[int
,float
,None
]) – The maximum size of the connection pool for each target in a target group. For Aurora MySQL, it is expressed as a percentage of the max_connections setting for the RDS DB instance or Aurora DB cluster used by the target group. 1-100 Default: 100max_idle_connections_percent (
Union
[int
,float
,None
]) – Controls how actively the proxy closes idle database connections in the connection pool. A high value enables the proxy to leave a high percentage of idle connections open. A low value causes the proxy to close idle client connections and return the underlying database connections to the connection pool. For Aurora MySQL, it is expressed as a percentage of the max_connections setting for the RDS DB instance or Aurora DB cluster used by the target group. between 0 and MaxConnectionsPercent Default: 50require_tls (
Optional
[bool
]) – A Boolean parameter that specifies whether Transport Layer Security (TLS) encryption is required for connections to the proxy. By enabling this setting, you can enforce encrypted TLS connections to the proxy. Default: truerole (
Optional
[IRole
]) – IAM role that the proxy uses to access secrets in AWS Secrets Manager. Default: - A role will automatically be createdsecurity_groups (
Optional
[Sequence
[ISecurityGroup
]]) – One or more VPC security groups to associate with the new proxy. Default: - No security groupssession_pinning_filters (
Optional
[Sequence
[SessionPinningFilter
]]) – Each item in the list represents a class of SQL operations that normally cause all later statements in a session using a proxy to be pinned to the same underlying database connection. Including an item in the list exempts that class of SQL operations from the pinning behavior. Default: - no session pinning filtersvpc_subnets (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – The subnets used by the proxy. Default: - the VPC default strategy if not specified.
- Return type:
- add_rotation_multi_user(id, *, secret, automatically_after=None, endpoint=None, exclude_characters=None, rotate_immediately_on_update=None, security_group=None, vpc_subnets=None)
Adds the multi user rotation to this instance.
- Parameters:
id (
str
) –secret (
ISecret
) – The secret to rotate. It must be a JSON string with the following format:: { “engine”: <required: database engine>, “host”: <required: instance host name>, “username”: <required: username>, “password”: <required: password>, “dbname”: <optional: database name>, “port”: <optional: if not specified, default port will be used>, “masterarn”: <required: the arn of the master secret which will be used to create users/change passwords> }automatically_after (
Optional
[Duration
]) – Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. Default: - 30 daysendpoint (
Optional
[IInterfaceVpcEndpoint
]) – The VPC interface endpoint to use for the Secrets Manager API. If you enable private DNS hostnames for your VPC private endpoint (the default), you don’t need to specify an endpoint. The standard Secrets Manager DNS hostname the Secrets Manager CLI and SDKs use by default (https://secretsmanager..amazonaws.com) automatically resolves to your VPC endpoint. Default: https://secretsmanager..amazonaws.com.rproxy.goskope.comexclude_characters (
Optional
[str
]) – Specifies characters to not include in generated passwords. Default: “ %+~`#$&*()|[]{}:;<>?!’/@”"rotate_immediately_on_update (
Optional
[bool
]) – Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. Default: truesecurity_group (
Optional
[ISecurityGroup
]) – The security group for the Lambda rotation function. Default: - a new security group is createdvpc_subnets (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – Where to place the rotation Lambda function. Default: - same placement as instance or cluster
- Return type:
- add_rotation_single_user(*, automatically_after=None, endpoint=None, exclude_characters=None, rotate_immediately_on_update=None, security_group=None, vpc_subnets=None)
Adds the single user rotation of the master password to this instance.
- Parameters:
automatically_after (
Optional
[Duration
]) – Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. Default: - 30 daysendpoint (
Optional
[IInterfaceVpcEndpoint
]) – The VPC interface endpoint to use for the Secrets Manager API. If you enable private DNS hostnames for your VPC private endpoint (the default), you don’t need to specify an endpoint. The standard Secrets Manager DNS hostname the Secrets Manager CLI and SDKs use by default (https://secretsmanager..amazonaws.com) automatically resolves to your VPC endpoint. Default: https://secretsmanager..amazonaws.com.rproxy.goskope.comexclude_characters (
Optional
[str
]) – Specifies characters to not include in generated passwords. Default: “ %+~`#$&*()|[]{}:;<>?!’/@”"rotate_immediately_on_update (
Optional
[bool
]) – Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. Default: truesecurity_group (
Optional
[ISecurityGroup
]) – The security group for the Lambda rotation function. Default: - a new security group is createdvpc_subnets (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – Where to place the rotation Lambda function. Default: - same placement as instance or cluster
- Return type:
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- as_secret_attachment_target()
Renders the secret attachment target specifications.
- Return type:
- grant_connect(grantee, db_user=None)
Grant the given identity connection access to the database.
- Parameters:
grantee (
IGrantable
) – the Principal to grant the permissions to.db_user (
Optional
[str
]) – the name of the database user to allow connecting as to the db instance, or the default database user, obtained from the Secret, if not specified.
- Return type:
- metric(metric_name, *, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
Return the given named metric for this DBInstance.
- Parameters:
metric_name (
str
) –account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) – Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No labelperiod (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_cpu_utilization(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
The percentage of CPU utilization.
Average over 5 minutes
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_database_connections(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
The number of database connections in use.
Average over 5 minutes
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_free_storage_space(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
The amount of available storage space.
Average over 5 minutes
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_freeable_memory(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
The amount of available random access memory.
Average over 5 minutes
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_read_iops(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
The average number of disk write I/O operations per second.
Average over 5 minutes
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- metric_write_iops(*, account=None, color=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
The average number of disk read I/O operations per second.
Average over 5 minutes
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Use theaws_cloudwatch.Stats
helper class to construct valid input strings. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” - “tmNN.NN” | “tm(NN.NN%:NN.NN%)” - “iqm” - “wmNN.NN” | “wm(NN.NN%:NN.NN%)” - “tcNN.NN” | “tc(NN.NN%:NN.NN%)” - “tsNN.NN” | “ts(NN.NN%:NN.NN%)” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- on_event(id, *, target=None, cross_stack_scope=None, description=None, event_pattern=None, rule_name=None)
Defines a CloudWatch event rule which triggers for instance events.
Use
rule.addEventPattern(pattern)
to specify a filter.- Parameters:
id (
str
) –target (
Optional
[IRuleTarget
]) – The target to register for the event. Default: - No target is added to the rule. UseaddTarget()
to add a target.cross_stack_scope (
Optional
[Construct
]) – The scope to use if the source of the rule and its target are in different Stacks (but in the same account & region). This helps dealing with cycles that often arise in these situations. Default: - none (the main scope will be used, even for cross-stack Events)description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.rule_name (
Optional
[str
]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.
- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- cloudwatch_log_groups
The log group is created when
cloudwatchLogsExports
is set.Each export value will create a separate log group.
- connections
Access to network connections.
- db_instance_endpoint_address
The instance endpoint address.
- db_instance_endpoint_port
The instance endpoint port.
- engine
The engine of this database Instance.
May be not known for imported Instances if it wasn’t provided explicitly, or for read replicas.
- env
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- instance_arn
The instance arn.
- instance_endpoint
The instance endpoint.
- instance_identifier
The instance identifier.
- instance_resource_id
The AWS Region-unique, immutable identifier for the DB instance.
This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB instance is accessed.
- node
The tree node.
- secret
The AWS Secrets Manager secret attached to the instance.
- stack
The stack in which this resource is defined.
- vpc
The VPC where this database instance is deployed.
Static Methods
- classmethod from_database_instance_attributes(scope, id, *, instance_endpoint_address, instance_identifier, port, security_groups, engine=None, instance_resource_id=None)
Import an existing database instance.
- Parameters:
scope (
Construct
) –id (
str
) –instance_endpoint_address (
str
) – The endpoint address.instance_identifier (
str
) – The instance identifier.port (
Union
[int
,float
]) – The database port.security_groups (
Sequence
[ISecurityGroup
]) – The security groups of the instance.engine (
Optional
[IInstanceEngine
]) – The engine of the existing database Instance. Default: - the imported Instance’s engine is unknowninstance_resource_id (
Optional
[str
]) – The AWS Region-unique, immutable identifier for the DB instance. This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB instance is accessed.
- Return type:
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool