Skip to content
v2.274.0

DatabaseInstanceReadReplica L2 construct ​

A read replica database instance.

Example ​

ts
declare const vpc: ec2.Vpc;
new rds.DatabaseInstanceFromSnapshot(this, 'Instance', {
  snapshotIdentifier: 'my-snapshot',
  engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_16_3 }),
  // optional, defaults to m5.large
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE),
  vpc,
});

declare const sourceInstance: rds.DatabaseInstance;
new rds.DatabaseInstanceReadReplica(this, 'ReadReplica', {
  sourceDatabaseInstance: sourceInstance,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE),
  vpc,
});
python
# 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
)
java
Vpc vpc;

DatabaseInstance sourceInstance;

DatabaseInstanceFromSnapshot.Builder.create(this, "Instance")
        .snapshotIdentifier("my-snapshot")
        .engine(DatabaseInstanceEngine.postgres(PostgresInstanceEngineProps.builder().version(PostgresEngineVersion.VER_16_3).build()))
        // optional, defaults to m5.large
        .instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.LARGE))
        .vpc(vpc)
        .build();
DatabaseInstanceReadReplica.Builder.create(this, "ReadReplica")
        .sourceDatabaseInstance(sourceInstance)
        .instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.LARGE))
        .vpc(vpc)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;

DatabaseInstance sourceInstance;

new DatabaseInstanceFromSnapshot(this, "Instance", new DatabaseInstanceFromSnapshotProps {
    SnapshotIdentifier = "my-snapshot",
    Engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 }),
    // optional, defaults to m5.large
    InstanceType = InstanceType.Of(InstanceClass.BURSTABLE2, InstanceSize.LARGE),
    Vpc = vpc
});
new DatabaseInstanceReadReplica(this, "ReadReplica", new DatabaseInstanceReadReplicaProps {
    SourceDatabaseInstance = sourceInstance,
    InstanceType = InstanceType.Of(InstanceClass.BURSTABLE2, InstanceSize.LARGE),
    Vpc = vpc
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc

var sourceInstance DatabaseInstance

rds.NewDatabaseInstanceFromSnapshot(this, jsii.String("Instance"), &DatabaseInstanceFromSnapshotProps{
	SnapshotIdentifier: jsii.String("my-snapshot"),
	Engine: rds.DatabaseInstanceEngine_Postgres(&PostgresInstanceEngineProps{
		Version: rds.PostgresEngineVersion_VER_16_3(),
	}),
	// optional, defaults to m5.large
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_BURSTABLE2, ec2.InstanceSize_LARGE),
	Vpc: Vpc,
})
rds.NewDatabaseInstanceReadReplica(this, jsii.String("ReadReplica"), &DatabaseInstanceReadReplicaProps{
	SourceDatabaseInstance: sourceInstance,
	InstanceType: ec2.InstanceType_*Of(ec2.InstanceClass_BURSTABLE2, ec2.InstanceSize_LARGE),
	Vpc: Vpc,
})

Initializer ​

ts
new DatabaseInstanceReadReplica(scope: Construct, id: string, props: DatabaseInstanceReadReplicaProps)
python
DatabaseInstanceReadReplica(scope: Construct, id: str, props: DatabaseInstanceReadReplicaProps)
java
new DatabaseInstanceReadReplica(Construct scope, String id, DatabaseInstanceReadReplicaProps props)
csharp
new DatabaseInstanceReadReplica(Construct scope, string id, DatabaseInstanceReadReplicaProps props)
go
NewDatabaseInstanceReadReplica(Scope Construct, Id *string, Props DatabaseInstanceReadReplicaProps)

Construct Props ​

allocatedStorageoptionalnumberallocated_storageoptionalint | floatallocatedStorageoptionalNumberAllocatedStorageoptionaldoubleAllocatedStorageoptional*float64#
The allocated storage size, specified in gibibytes (GiB).

Default: The replica will inherit the allocated storage of the source database instance

applyImmediatelyoptionalbooleanapply_immediatelyoptionalboolapplyImmediatelyoptionalBooleanApplyImmediatelyoptionalboolApplyImmediatelyoptional*bool#
Specifies whether changes to the DB instance and any pending modifications are applied immediately, regardless of the `preferredMaintenanceWindow` setting.

Default: Changes will be applied immediately

notes

If set to false, changes are applied during the next maintenance window.

Until RDS applies the changes, the DB instance remains in a drift state. As a result, the configuration doesn't fully reflect the requested modifications and temporarily diverges from the intended state.

This property also determines whether the DB instance reboots when a static parameter is modified in the associated DB parameter group.

autoMinorVersionUpgradeoptionalbooleanauto_minor_version_upgradeoptionalboolautoMinorVersionUpgradeoptionalBooleanAutoMinorVersionUpgradeoptionalboolAutoMinorVersionUpgradeoptional*bool= true#
Indicates that minor engine upgrades are applied automatically to the DB instance during the maintenance window.
availabilityZoneoptionalstringavailability_zoneoptionalstravailabilityZoneoptionalStringAvailabilityZoneoptionalstringAvailabilityZoneoptional*string#
The name of the Availability Zone where the DB instance will be located.

Default: no preference

backupRetentionoptionalDurationbackup_retentionoptionalDurationbackupRetentionoptionalDurationBackupRetentionoptionalDurationBackupRetentionoptionalDuration#
The number of days during which automatic DB snapshots are retained.

Default: Duration.days(1) for source instances, disabled for read replicas

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.

caCertificateoptionalCaCertificateca_certificateoptionalCaCertificatecaCertificateoptionalCaCertificateCaCertificateoptionalCaCertificateCaCertificateoptionalCaCertificate#
The identifier of the CA certificate for this DB instance.

Default: RDS will choose a certificate authority

Specifying or updating this property triggers a reboot.

For RDS DB engines:

cloudwatchLogsExportsoptionalstring[]cloudwatch_logs_exportsoptionaltyping.List[str]cloudwatchLogsExportsoptionalList<String>CloudwatchLogsExportsoptionalstring[]CloudwatchLogsExportsoptional*[]*string#
The list of log types that need to be enabled for exporting to CloudWatch Logs.

Default: no log exports

cloudwatchLogsRetentionoptionalRetentionDayscloudwatch_logs_retentionoptionalRetentionDayscloudwatchLogsRetentionoptionalRetentionDaysCloudwatchLogsRetentionoptionalRetentionDaysCloudwatchLogsRetentionoptionalRetentionDays#
The number of days log events are kept in CloudWatch Logs.

Default: logs never expire

When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to Infinity.

cloudwatchLogsRetentionRoleoptionalIRolecloudwatch_logs_retention_roleoptionalIRolecloudwatchLogsRetentionRoleoptionalIRoleCloudwatchLogsRetentionRoleoptionalIRoleCloudwatchLogsRetentionRoleoptionalIRole#
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

Default: a new role is created.

copyTagsToSnapshotoptionalbooleancopy_tags_to_snapshotoptionalboolcopyTagsToSnapshotoptionalBooleanCopyTagsToSnapshotoptionalboolCopyTagsToSnapshotoptional*bool= true#
Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance.
databaseInsightsModeoptionalDatabaseInsightsModedatabase_insights_modeoptionalDatabaseInsightsModedatabaseInsightsModeoptionalDatabaseInsightsModeDatabaseInsightsModeoptionalDatabaseInsightsModeDatabaseInsightsModeoptionalDatabaseInsightsMode#
The database insights mode.

Default: DatabaseInsightsMode.STANDARD when performance insights are enabled, otherwise not set.

deleteAutomatedBackupsoptionalbooleandelete_automated_backupsoptionalbooldeleteAutomatedBackupsoptionalBooleanDeleteAutomatedBackupsoptionalboolDeleteAutomatedBackupsoptional*bool= true#
Indicates whether automated backups should be deleted or retained when you delete a DB instance.
deletionProtectionoptionalbooleandeletion_protectionoptionalbooldeletionProtectionoptionalBooleanDeletionProtectionoptionalboolDeletionProtectionoptional*bool#
Indicates whether the DB instance should have deletion protection enabled.

Default: true if removalPolicy is RETAIN, false otherwise

domainoptionalstringdomainoptionalstrdomainoptionalStringDomainoptionalstringDomainoptional*string#
The Active Directory directory ID to create the DB instance in.

Default: Do not join domain

domainRoleoptionalIRoleRefdomain_roleoptionalIRoleRefdomainRoleoptionalIRoleRefDomainRoleoptionalIRoleRefDomainRoleoptionalIRoleRef#
The IAM role to be used when making API calls to the Directory Service.

Default: The role will be created for you if DatabaseInstanceNewProps#domain is specified

The role needs the AWS-managed policy AmazonRDSDirectoryServiceAccess or equivalent.

enablePerformanceInsightsoptionalbooleanenable_performance_insightsoptionalboolenablePerformanceInsightsoptionalBooleanEnablePerformanceInsightsoptionalboolEnablePerformanceInsightsoptional*bool#
Whether to enable Performance Insights for the DB instance.

Default: false, unless performanceInsightRetention or performanceInsightEncryptionKey is set.

engineLifecycleSupportoptionalEngineLifecycleSupportengine_lifecycle_supportoptionalEngineLifecycleSupportengineLifecycleSupportoptionalEngineLifecycleSupportEngineLifecycleSupportoptionalEngineLifecycleSupportEngineLifecycleSupportoptionalEngineLifecycleSupport#
The life cycle type for this DB instance.

Default: undefined - AWS RDS default setting is EngineLifecycleSupport.OPEN_SOURCE_RDS_EXTENDED_SUPPORT

This setting applies only to RDS for MySQL and RDS for PostgreSQL.

iamAuthenticationoptionalbooleaniam_authenticationoptionalbooliamAuthenticationoptionalBooleanIamAuthenticationoptionalboolIamAuthenticationoptional*bool= false#
Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.
instanceIdentifieroptionalstringinstance_identifieroptionalstrinstanceIdentifieroptionalStringInstanceIdentifieroptionalstringInstanceIdentifieroptional*string#
A name for the DB instance.

Default: a CloudFormation generated name

If you specify a name, AWS CloudFormation converts it to lowercase.

instanceTypeInstanceTypeinstance_typeInstanceTypeinstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTyperequired#
The name of the compute and memory capacity classes.
iopsoptionalnumberiopsoptionalint | floatiopsoptionalNumberIopsoptionaldoubleIopsoptional*float64#
The number of I/O operations per second (IOPS) that the database provisions.

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).

The value must be equal to or greater than 1000.

maxAllocatedStorageoptionalnumbermax_allocated_storageoptionalint | floatmaxAllocatedStorageoptionalNumberMaxAllocatedStorageoptionaldoubleMaxAllocatedStorageoptional*float64#
Upper limit to which RDS can scale the storage in GiB(Gibibyte).

Default: No autoscaling of RDS instance

monitoringIntervaloptionalDurationmonitoring_intervaloptionalDurationmonitoringIntervaloptionalDurationMonitoringIntervaloptionalDurationMonitoringIntervaloptionalDuration#
The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instance.

Default: no enhanced monitoring

monitoringRoleoptionalIRoleRefmonitoring_roleoptionalIRoleRefmonitoringRoleoptionalIRoleRefMonitoringRoleoptionalIRoleRefMonitoringRoleoptionalIRoleRef#
Role that will be used to manage DB instance monitoring.

Default: A role is automatically created for you

multiAzoptionalbooleanmulti_azoptionalboolmultiAzoptionalBooleanMultiAzoptionalboolMultiAzoptional*bool= false#
Specifies if the database instance is a multiple Availability Zone deployment.
networkTypeoptionalNetworkTypenetwork_typeoptionalNetworkTypenetworkTypeoptionalNetworkTypeNetworkTypeoptionalNetworkTypeNetworkTypeoptionalNetworkType= IPV4#
The network type of the DB instance.
optionGroupoptionalIOptionGroupoption_groupoptionalIOptionGroupoptionGroupoptionalIOptionGroupOptionGroupoptionalIOptionGroupOptionGroupoptionalIOptionGroup#
The option group to associate with the instance.

Default: no option group

parameterGroupoptionalIParameterGroupparameter_groupoptionalIParameterGroupparameterGroupoptionalIParameterGroupParameterGroupoptionalIParameterGroupParameterGroupoptionalIParameterGroup#
The DB parameter group to associate with the instance.

Default: no parameter group

performanceInsightEncryptionKeyoptionalIKeyRefperformance_insight_encryption_keyoptionalIKeyRefperformanceInsightEncryptionKeyoptionalIKeyRefPerformanceInsightEncryptionKeyoptionalIKeyRefPerformanceInsightEncryptionKeyoptionalIKeyRef#
The AWS KMS key for encryption of Performance Insights data.

Default: default master key

performanceInsightRetentionoptionalPerformanceInsightRetentionperformance_insight_retentionoptionalPerformanceInsightRetentionperformanceInsightRetentionoptionalPerformanceInsightRetentionPerformanceInsightRetentionoptionalPerformanceInsightRetentionPerformanceInsightRetentionoptionalPerformanceInsightRetention#
The amount of time, in days, to retain Performance Insights data.

Default: 7 this is the free tier

If you set databaseInsightsMode to DatabaseInsightsMode.ADVANCED, you must set this property to PerformanceInsightRetention.MONTHS_15.

portoptionalnumberportoptionalint | floatportoptionalNumberPortoptionaldoublePortoptional*float64#
The port for the instance.

Default: the default port for the chosen engine.

preferredBackupWindowoptionalstringpreferred_backup_windowoptionalstrpreferredBackupWindowoptionalStringPreferredBackupWindowoptionalstringPreferredBackupWindowoptional*string#
The daily time range during which automated backups are performed.

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.BackupWindow

Constraints:

  • Must be in the format hh24:mi-hh24:mi.
  • Must be in Universal Coordinated Time (UTC).
  • Must not conflict with the preferred maintenance window.
  • Must be at least 30 minutes.
preferredMaintenanceWindowoptionalstringpreferred_maintenance_windowoptionalstrpreferredMaintenanceWindowoptionalStringPreferredMaintenanceWindowoptionalstringPreferredMaintenanceWindowoptional*string#
The weekly time range (in UTC) during which system maintenance can occur.

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.DBMaintenance

Format: ddd:hh24:mi-ddd:hh24:mi Constraint: Minimum 30-minute window

processorFeaturesoptionalProcessorFeaturesprocessor_featuresoptionalProcessorFeaturesprocessorFeaturesoptionalProcessorFeaturesProcessorFeaturesoptionalProcessorFeaturesProcessorFeaturesoptionalProcessorFeatures#
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_ConfigureProcessor

publiclyAccessibleoptionalbooleanpublicly_accessibleoptionalboolpubliclyAccessibleoptionalBooleanPubliclyAccessibleoptionalboolPubliclyAccessibleoptional*bool#
Indicates whether the DB instance is an internet-facing instance.

Default: true if the instance's vpcSubnets is subnetType: SubnetType.PUBLIC, false otherwise

If not specified, the instance's vpcSubnets will be used to determine if the instance is internet-facing or not.

removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy#
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)

s3ExportBucketsoptionalIBucket[]s3_export_bucketsoptionaltyping.List[IBucket]s3ExportBucketsoptionalList<IBucket>S3ExportBucketsoptionalIBucket[]S3ExportBucketsoptional*[]IBucket= None#
S3 buckets that you want to load data into.

This property must not be used if s3ExportRole is used.

For Microsoft SQL Server:

s3ExportRoleoptionalIRoles3_export_roleoptionalIRoles3ExportRoleoptionalIRoleS3ExportRoleoptionalIRoleS3ExportRoleoptionalIRole#
Role that will be associated with this DB instance to enable S3 export.

Default: New role is created if s3ExportBuckets is set, no role is defined otherwise

This property must not be used if s3ExportBuckets is used.

For Microsoft SQL Server:

s3ImportBucketsoptionalIBucket[]s3_import_bucketsoptionaltyping.List[IBucket]s3ImportBucketsoptionalList<IBucket>S3ImportBucketsoptionalIBucket[]S3ImportBucketsoptional*[]IBucket= None#
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 if s3ImportRole is used.

For Microsoft SQL Server:

s3ImportRoleoptionalIRoles3_import_roleoptionalIRoles3ImportRoleoptionalIRoleS3ImportRoleoptionalIRoleS3ImportRoleoptionalIRole#
Role that will be associated with this DB instance to enable S3 import.

Default: New role is created if s3ImportBuckets is set, no role is defined otherwise

This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines.

This property must not be used if s3ImportBuckets is used.

For Microsoft SQL Server:

securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup#
The security groups to assign to the DB instance.

Default: a new security group is created

sourceDatabaseInstanceIDatabaseInstancesource_database_instanceIDatabaseInstancesourceDatabaseInstanceIDatabaseInstanceSourceDatabaseInstanceIDatabaseInstanceSourceDatabaseInstanceIDatabaseInstancerequired#
The source database instance.

Each DB instance can have a limited number of read replicas. For more information, see https://docs.aws.amazon.com/AmazonRDS/latest/DeveloperGuide/USER_ReadRepl.html.

storageEncryptedoptionalbooleanstorage_encryptedoptionalboolstorageEncryptedoptionalBooleanStorageEncryptedoptionalboolStorageEncryptedoptional*bool#
Indicates whether the DB instance is encrypted.

Default: true if storageEncryptionKey has been provided, false otherwise

storageEncryptionKeyoptionalIKeyRefstorage_encryption_keyoptionalIKeyRefstorageEncryptionKeyoptionalIKeyRefStorageEncryptionKeyoptionalIKeyRefStorageEncryptionKeyoptionalIKeyRef#
The KMS key that's used to encrypt the DB instance.

Default: default master key if storageEncrypted is true, no key otherwise

storageThroughputoptionalnumberstorage_throughputoptionalint | floatstorageThroughputoptionalNumberStorageThroughputoptionaldoubleStorageThroughputoptional*float64#
The storage throughput, specified in mebibytes per second (MiBps).

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).

Only applicable for GP3.

storageTypeoptionalStorageTypestorage_typeoptionalStorageTypestorageTypeoptionalStorageTypeStorageTypeoptionalStorageTypeStorageTypeoptionalStorageType= StorageType.GP2#
The storage type to associate with the DB instance.

Storage types supported are gp2, gp3, io1, io2, and standard.

subnetGroupoptionalIDBSubnetGroupRefsubnet_groupoptionalIDBSubnetGroupRefsubnetGroupoptionalIDBSubnetGroupRefSubnetGroupoptionalIDBSubnetGroupRefSubnetGroupoptionalIDBSubnetGroupRef#
Existing subnet group for the instance.

Default: a new subnet group will be created.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC network where the DB subnet group should be created.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection#
The type of subnets to add to the created DB subnet group.

Default: private subnets

Properties ​

cloudwatchLogGroups{ [key: string]: ILogGroup }cloudwatch_log_groupstyping.Mapping[str, ILogGroup]cloudwatchLogGroupsMap<String, ILogGroup>CloudwatchLogGroupsIDictionary<string, ILogGroup>CloudwatchLogGroups*map[string]ILogGroup#
The log group is created when `cloudwatchLogsExports` is set.

Each export value will create a separate log group.

connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnections#
Access to network connections.
dbInstanceEndpointAddressstringdb_instance_endpoint_addressstrdbInstanceEndpointAddressStringDbInstanceEndpointAddressstringDbInstanceEndpointAddress*string#
The instance endpoint address.
dbInstanceEndpointPortstringdb_instance_endpoint_portstrdbInstanceEndpointPortStringDbInstanceEndpointPortstringDbInstanceEndpointPort*string#
The instance endpoint port.
dbInstanceRefDBInstanceReferencedb_instance_refDBInstanceReferencedbInstanceRefDBInstanceReferenceDbInstanceRefDBInstanceReferenceDbInstanceRefDBInstanceReference#
A reference to this database instance.
enginemay be undefinedIInstanceEngineenginemay be undefinedIInstanceEngineenginemay be undefinedIInstanceEngineEnginemay be undefinedIInstanceEngineEnginemay be undefinedIInstanceEngine#
The engine of this database Instance.

May be not known for imported Instances if it wasn't provided explicitly, or for read replicas.

The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

instanceArnstringinstance_arnstrinstanceArnStringInstanceArnstringInstanceArn*string#
The instance arn.
instanceEndpointEndpointinstance_endpointEndpointinstanceEndpointEndpointInstanceEndpointEndpointInstanceEndpointEndpoint#
The instance endpoint.
instanceIdentifierstringinstance_identifierstrinstanceIdentifierStringInstanceIdentifierstringInstanceIdentifier*string#
The instance identifier.
instanceResourceIdmay be undefinedstringinstance_resource_idmay be undefinedstrinstanceResourceIdmay be undefinedStringInstanceResourceIdmay be undefinedstringInstanceResourceIdmay be undefined*string#
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.

nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStack#
The stack in which this resource is defined.
vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpc#
The VPC where this database instance is deployed.

Methods ​

addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxydef add_proxy(self, id: str, options: DatabaseProxyOptions) -> DatabaseProxypublic DatabaseProxy addProxy(String id, DatabaseProxyOptions options)public DatabaseProxy AddProxy(string id, DatabaseProxyOptions options)func AddProxy(Id *string, Options DatabaseProxyOptions) DatabaseProxy#
Add a new db proxy to this instance.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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).

asSecretAttachmentTarget(): SecretAttachmentTargetPropsdef as_secret_attachment_target(self, ) -> SecretAttachmentTargetPropspublic SecretAttachmentTargetProps asSecretAttachmentTarget()public SecretAttachmentTargetProps AsSecretAttachmentTarget()func AsSecretAttachmentTarget() SecretAttachmentTargetProps#
Renders the secret attachment target specifications.
fromDatabaseInstanceAttributes(scope: Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance@staticmethod def from_database_instance_attributes(scope: Construct, id: str, attrs: DatabaseInstanceAttributes) -> IDatabaseInstancepublic static IDatabaseInstance fromDatabaseInstanceAttributes(Construct scope, String id, DatabaseInstanceAttributes attrs)public static IDatabaseInstance FromDatabaseInstanceAttributes(Construct scope, string id, DatabaseInstanceAttributes attrs)func FromDatabaseInstanceAttributes(Scope Construct, Id *string, Attrs DatabaseInstanceAttributes) IDatabaseInstancestatic#
Import an existing database instance.
fromLookup(scope: Construct, id: string, options: DatabaseInstanceLookupOptions): IDatabaseInstance@staticmethod def from_lookup(scope: Construct, id: str, options: DatabaseInstanceLookupOptions) -> IDatabaseInstancepublic static IDatabaseInstance fromLookup(Construct scope, String id, DatabaseInstanceLookupOptions options)public static IDatabaseInstance FromLookup(Construct scope, string id, DatabaseInstanceLookupOptions options)func FromLookup(Scope Construct, Id *string, Options DatabaseInstanceLookupOptions) IDatabaseInstancestatic#
Lookup an existing DatabaseInstance using instanceIdentifier.
grantConnect(grantee: IGrantable, dbUser?: string): Grantdef grant_connect(self, grantee: IGrantable, db_user: typing.Optional[str] = None) -> Grantpublic Grant grantConnect(IGrantable grantee, String dbUser)public Grant GrantConnect(IGrantable grantee, string? dbUser = null)func GrantConnect(Grantee IGrantable, DbUser *string) Grant#
[disable-awslint:no-grants].
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct 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 class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof 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 the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#
Return the given named metric for this DBInstance.
metricCPUUtilization(props?: MetricOptions): Metricdef metric_cpu_utilization(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricCPUUtilization(MetricOptions props)public Metric MetricCPUUtilization(MetricOptions? props = null)func MetricCPUUtilization(Props MetricOptions) Metric#
The percentage of CPU utilization.

Average over 5 minutes

metricDatabaseConnections(props?: MetricOptions): Metricdef metric_database_connections(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricDatabaseConnections(MetricOptions props)public Metric MetricDatabaseConnections(MetricOptions? props = null)func MetricDatabaseConnections(Props MetricOptions) Metric#
The number of database connections in use.

Average over 5 minutes

metricFreeableMemory(props?: MetricOptions): Metricdef metric_freeable_memory(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricFreeableMemory(MetricOptions props)public Metric MetricFreeableMemory(MetricOptions? props = null)func MetricFreeableMemory(Props MetricOptions) Metric#
The amount of available random access memory.

Average over 5 minutes

metricFreeStorageSpace(props?: MetricOptions): Metricdef metric_free_storage_space(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricFreeStorageSpace(MetricOptions props)public Metric MetricFreeStorageSpace(MetricOptions? props = null)func MetricFreeStorageSpace(Props MetricOptions) Metric#
The amount of available storage space.

Average over 5 minutes

metricReadIOPS(props?: MetricOptions): Metricdef metric_read_iops(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricReadIOPS(MetricOptions props)public Metric MetricReadIOPS(MetricOptions? props = null)func MetricReadIOPS(Props MetricOptions) Metric#
The average number of disk read I/O operations per second. The average number of disk write I/O operations per second.

Average over 5 minutes

metricWriteIOPS(props?: MetricOptions): Metricdef metric_write_iops(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricWriteIOPS(MetricOptions props)public Metric MetricWriteIOPS(MetricOptions? props = null)func MetricWriteIOPS(Props MetricOptions) Metric#
The average number of disk write I/O operations per second. The average number of disk read I/O operations per second.

Average over 5 minutes

onEvent(id: string, options?: OnEventOptions): Ruledef on_event(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onEvent(String id, OnEventOptions options)public Rule OnEvent(string id, OnEventOptions? options = null)func OnEvent(Id *string, Options OnEventOptions) Rule#
Defines a CloudWatch event rule which triggers for instance events.

Use rule.addEventPattern(pattern) to specify a filter.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.