DatabaseInstanceReadReplica L2 construct
A read replica database instance.
Example
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,
});
# 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
)
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();
// 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
});
// 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
new DatabaseInstanceReadReplica(scope: Construct, id: string, props: DatabaseInstanceReadReplicaProps)
DatabaseInstanceReadReplica(scope: Construct, id: str, props: DatabaseInstanceReadReplicaProps)
new DatabaseInstanceReadReplica(Construct scope, String id, DatabaseInstanceReadReplicaProps props)
new DatabaseInstanceReadReplica(Construct scope, string id, DatabaseInstanceReadReplicaProps props)
NewDatabaseInstanceReadReplica(Scope Construct, Id *string, Props DatabaseInstanceReadReplicaProps)
Construct Props
allocatedStorageoptionalnumberallocated_storageoptionalint | floatallocatedStorageoptionalNumberAllocatedStorageoptionaldoubleAllocatedStorageoptional*float64#Default: The replica will inherit the allocated storage of the source database instance
applyImmediatelyoptionalbooleanapply_immediatelyoptionalboolapplyImmediatelyoptionalBooleanApplyImmediatelyoptionalboolApplyImmediatelyoptional*bool#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#availabilityZoneoptionalstringavailability_zoneoptionalstravailabilityZoneoptionalStringAvailabilityZoneoptionalstringAvailabilityZoneoptional*string#Default: no preference
backupRetentionoptionalDurationbackup_retentionoptionalDurationbackupRetentionoptionalDurationBackupRetentionoptionalDurationBackupRetentionoptionalDuration#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#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#Default: no log exports
cloudwatchLogsRetentionoptionalRetentionDayscloudwatch_logs_retentionoptionalRetentionDayscloudwatchLogsRetentionoptionalRetentionDaysCloudwatchLogsRetentionoptionalRetentionDaysCloudwatchLogsRetentionoptionalRetentionDays#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#Default: a new role is created.
copyTagsToSnapshotoptionalbooleancopy_tags_to_snapshotoptionalboolcopyTagsToSnapshotoptionalBooleanCopyTagsToSnapshotoptionalboolCopyTagsToSnapshotoptional*bool= true#databaseInsightsModeoptionalDatabaseInsightsModedatabase_insights_modeoptionalDatabaseInsightsModedatabaseInsightsModeoptionalDatabaseInsightsModeDatabaseInsightsModeoptionalDatabaseInsightsModeDatabaseInsightsModeoptionalDatabaseInsightsMode#Default: DatabaseInsightsMode.STANDARD when performance insights are enabled, otherwise not set.
deleteAutomatedBackupsoptionalbooleandelete_automated_backupsoptionalbooldeleteAutomatedBackupsoptionalBooleanDeleteAutomatedBackupsoptionalboolDeleteAutomatedBackupsoptional*bool= true#deletionProtectionoptionalbooleandeletion_protectionoptionalbooldeletionProtectionoptionalBooleanDeletionProtectionoptionalboolDeletionProtectionoptional*bool#Default: true if removalPolicy is RETAIN, false otherwise
Default: Do not join domain
domainRoleoptionalIRoleRefdomain_roleoptionalIRoleRefdomainRoleoptionalIRoleRefDomainRoleoptionalIRoleRefDomainRoleoptionalIRoleRef#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#Default: false, unless performanceInsightRetention or performanceInsightEncryptionKey is set.
engineLifecycleSupportoptionalEngineLifecycleSupportengine_lifecycle_supportoptionalEngineLifecycleSupportengineLifecycleSupportoptionalEngineLifecycleSupportEngineLifecycleSupportoptionalEngineLifecycleSupportEngineLifecycleSupportoptionalEngineLifecycleSupport#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#instanceIdentifieroptionalstringinstance_identifieroptionalstrinstanceIdentifieroptionalStringInstanceIdentifieroptionalstringInstanceIdentifieroptional*string#Default: a CloudFormation generated name
If you specify a name, AWS CloudFormation converts it to lowercase.
instanceTypeInstanceTypeinstance_typeInstanceTypeinstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTyperequired#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#Default: No autoscaling of RDS instance
monitoringIntervaloptionalDurationmonitoring_intervaloptionalDurationmonitoringIntervaloptionalDurationMonitoringIntervaloptionalDurationMonitoringIntervaloptionalDuration#Default: no enhanced monitoring
monitoringRoleoptionalIRoleRefmonitoring_roleoptionalIRoleRefmonitoringRoleoptionalIRoleRefMonitoringRoleoptionalIRoleRefMonitoringRoleoptionalIRoleRef#Default: A role is automatically created for you
multiAzoptionalbooleanmulti_azoptionalboolmultiAzoptionalBooleanMultiAzoptionalboolMultiAzoptional*bool= false#networkTypeoptionalNetworkTypenetwork_typeoptionalNetworkTypenetworkTypeoptionalNetworkTypeNetworkTypeoptionalNetworkTypeNetworkTypeoptionalNetworkType= IPV4#optionGroupoptionalIOptionGroupoption_groupoptionalIOptionGroupoptionGroupoptionalIOptionGroupOptionGroupoptionalIOptionGroupOptionGroupoptionalIOptionGroup#Default: no option group
parameterGroupoptionalIParameterGroupparameter_groupoptionalIParameterGroupparameterGroupoptionalIParameterGroupParameterGroupoptionalIParameterGroupParameterGroupoptionalIParameterGroup#Default: no parameter group
performanceInsightEncryptionKeyoptionalIKeyRefperformance_insight_encryption_keyoptionalIKeyRefperformanceInsightEncryptionKeyoptionalIKeyRefPerformanceInsightEncryptionKeyoptionalIKeyRefPerformanceInsightEncryptionKeyoptionalIKeyRef#Default: default master key
performanceInsightRetentionoptionalPerformanceInsightRetentionperformance_insight_retentionoptionalPerformanceInsightRetentionperformanceInsightRetentionoptionalPerformanceInsightRetentionPerformanceInsightRetentionoptionalPerformanceInsightRetentionPerformanceInsightRetentionoptionalPerformanceInsightRetention#Default: 7 this is the free tier
If you set databaseInsightsMode to DatabaseInsightsMode.ADVANCED, you must set this property to PerformanceInsightRetention.MONTHS_15.
Default: the default port for the chosen engine.
preferredBackupWindowoptionalstringpreferred_backup_windowoptionalstrpreferredBackupWindowoptionalStringPreferredBackupWindowoptionalstringPreferredBackupWindowoptional*string#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#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#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#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#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#This property must not be used if s3ExportRole is used.
For Microsoft SQL Server:
s3ExportRoleoptionalIRoles3_export_roleoptionalIRoles3ExportRoleoptionalIRoleS3ExportRoleoptionalIRoleS3ExportRoleoptionalIRole#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#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#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#Default: a new security group is created
sourceDatabaseInstanceIDatabaseInstancesource_database_instanceIDatabaseInstancesourceDatabaseInstanceIDatabaseInstanceSourceDatabaseInstanceIDatabaseInstanceSourceDatabaseInstanceIDatabaseInstancerequired#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#Default: true if storageEncryptionKey has been provided, false otherwise
storageEncryptionKeyoptionalIKeyRefstorage_encryption_keyoptionalIKeyRefstorageEncryptionKeyoptionalIKeyRefStorageEncryptionKeyoptionalIKeyRefStorageEncryptionKeyoptionalIKeyRef#Default: default master key if storageEncrypted is true, no key otherwise
storageThroughputoptionalnumberstorage_throughputoptionalint | floatstorageThroughputoptionalNumberStorageThroughputoptionaldoubleStorageThroughputoptional*float64#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#Storage types supported are gp2, gp3, io1, io2, and standard.
subnetGroupoptionalIDBSubnetGroupRefsubnet_groupoptionalIDBSubnetGroupRefsubnetGroupoptionalIDBSubnetGroupRefSubnetGroupoptionalIDBSubnetGroupRefSubnetGroupoptionalIDBSubnetGroupRef#Default: a new subnet group will be created.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection#Default: private subnets
Properties
cloudwatchLogGroups{ [key: string]: ILogGroup }cloudwatch_log_groupstyping.Mapping[str, ILogGroup]cloudwatchLogGroupsMap<String, ILogGroup>CloudwatchLogGroupsIDictionary<string, ILogGroup>CloudwatchLogGroups*map[string]ILogGrouprequired#Each export value will create a separate log group.
connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#dbInstanceEndpointAddressstringdb_instance_endpoint_addressstrdbInstanceEndpointAddressStringDbInstanceEndpointAddressstringDbInstanceEndpointAddress*stringrequired#dbInstanceEndpointPortstringdb_instance_endpoint_portstrdbInstanceEndpointPortStringDbInstanceEndpointPortstringDbInstanceEndpointPort*stringrequired#dbInstanceRefDBInstanceReferencedb_instance_refDBInstanceReferencedbInstanceRefDBInstanceReferenceDbInstanceRefDBInstanceReferenceDbInstanceRefDBInstanceReferencerequired#enginemay be undefinedIInstanceEngineenginemay be undefinedIInstanceEngineenginemay be undefinedIInstanceEngineEnginemay be undefinedIInstanceEngineEnginemay be undefinedIInstanceEngine#May be not known for imported Instances if it wasn't provided explicitly, or for read replicas.
envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#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.
instanceEndpointEndpointinstance_endpointEndpointinstanceEndpointEndpointInstanceEndpointEndpointInstanceEndpointEndpointrequired#instanceIdentifierstringinstance_identifierstrinstanceIdentifierStringInstanceIdentifierstringInstanceIdentifier*stringrequired#instanceResourceIdmay be undefinedstringinstance_resource_idmay be undefinedstrinstanceResourceIdmay be undefinedStringInstanceResourceIdmay be undefinedstringInstanceResourceIdmay be undefined*string#This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB instance is accessed.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#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#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)#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)#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#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#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#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#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#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#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#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#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#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#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#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#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#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#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#Use rule.addEventPattern(pattern) to specify a filter.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#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.