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
allocatedStoragenumberallocated_storageint | floatallocatedStorageNumberAllocatedStoragedoubleAllocatedStorage*float64= The replica will inherit the all…#default
Default: The replica will inherit the allocated storage of the source database instance
applyImmediatelybooleanapply_immediatelyboolapplyImmediatelyBooleanApplyImmediatelyboolApplyImmediately*bool= Changes will be applied immediat…#notes · default
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.
Default: Changes will be applied immediately
autoMinorVersionUpgradebooleanauto_minor_version_upgradeboolautoMinorVersionUpgradeBooleanAutoMinorVersionUpgradeboolAutoMinorVersionUpgrade*bool= true#availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*string= no preference#backupRetentionDurationbackup_retentionDurationbackupRetentionDurationBackupRetentionDurationBackupRetentionDuration= Duration.days(1) for source inst…#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
Default: Duration.days(1) for source instances, disabled for read replicas
caCertificateCaCertificateca_certificateCaCertificatecaCertificateCaCertificateCaCertificateCaCertificateCaCertificateCaCertificate= RDS will choose a certificate au…#Specifying or updating this property triggers a reboot.
For RDS DB engines:
default
Default: RDS will choose a certificate authority
cloudwatchLogsExportsstring[]cloudwatch_logs_exportstyping.List[str]cloudwatchLogsExportsList<String>CloudwatchLogsExportsstring[]CloudwatchLogsExports*[]*string= no log exports#cloudwatchLogsRetentionRetentionDayscloudwatch_logs_retentionRetentionDayscloudwatchLogsRetentionRetentionDaysCloudwatchLogsRetentionRetentionDaysCloudwatchLogsRetentionRetentionDays= 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.
cloudwatchLogsRetentionRoleIRolecloudwatch_logs_retention_roleIRolecloudwatchLogsRetentionRoleIRoleCloudwatchLogsRetentionRoleIRoleCloudwatchLogsRetentionRoleIRole= a new role is created.#copyTagsToSnapshotbooleancopy_tags_to_snapshotboolcopyTagsToSnapshotBooleanCopyTagsToSnapshotboolCopyTagsToSnapshot*bool= true#databaseInsightsModeDatabaseInsightsModedatabase_insights_modeDatabaseInsightsModedatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsMode= DatabaseInsightsMode.STANDARD wh…#default
Default: DatabaseInsightsMode.STANDARD when performance insights are enabled, otherwise not set.
deleteAutomatedBackupsbooleandelete_automated_backupsbooldeleteAutomatedBackupsBooleanDeleteAutomatedBackupsboolDeleteAutomatedBackups*bool= true#deletionProtectionbooleandeletion_protectionbooldeletionProtectionBooleanDeletionProtectionboolDeletionProtection*bool= true if ``removalPolicy`` is RET…#default
Default: true if removalPolicy is RETAIN, false otherwise
domainRoleIRoleRefdomain_roleIRoleRefdomainRoleIRoleRefDomainRoleIRoleRefDomainRoleIRoleRef= The role will be created for you…#The role needs the AWS-managed policy AmazonRDSDirectoryServiceAccess or equivalent.
default
Default: The role will be created for you if DatabaseInstanceNewProps#domain is specified
enablePerformanceInsightsbooleanenable_performance_insightsboolenablePerformanceInsightsBooleanEnablePerformanceInsightsboolEnablePerformanceInsights*bool= false, unless ``performanceInsig…#default
Default: false, unless performanceInsightRetention or performanceInsightEncryptionKey is set.
engineLifecycleSupportEngineLifecycleSupportengine_lifecycle_supportEngineLifecycleSupportengineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupport= undefined - AWS RDS default sett…#This setting applies only to RDS for MySQL and RDS for PostgreSQL.
default
Default: undefined - AWS RDS default setting is EngineLifecycleSupport.OPEN_SOURCE_RDS_EXTENDED_SUPPORT
iamAuthenticationbooleaniam_authenticationbooliamAuthenticationBooleanIamAuthenticationboolIamAuthentication*bool= false#instanceIdentifierstringinstance_identifierstrinstanceIdentifierStringInstanceIdentifierstringInstanceIdentifier*string= a CloudFormation generated name#If you specify a name, AWS CloudFormation converts it to lowercase.
instanceTypeInstanceTypeinstance_typeInstanceTypeinstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTyperequired#The value must be equal to or greater than 1000.
default
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).
maxAllocatedStoragenumbermax_allocated_storageint | floatmaxAllocatedStorageNumberMaxAllocatedStoragedoubleMaxAllocatedStorage*float64= No autoscaling of RDS instance#monitoringIntervalDurationmonitoring_intervalDurationmonitoringIntervalDurationMonitoringIntervalDurationMonitoringIntervalDuration= no enhanced monitoring#monitoringRoleIRoleRefmonitoring_roleIRoleRefmonitoringRoleIRoleRefMonitoringRoleIRoleRefMonitoringRoleIRoleRef= A role is automatically created …#default
Default: A role is automatically created for you
networkTypeNetworkTypenetwork_typeNetworkTypenetworkTypeNetworkTypeNetworkTypeNetworkTypeNetworkTypeNetworkType= IPV4#optionGroupIOptionGroupoption_groupIOptionGroupoptionGroupIOptionGroupOptionGroupIOptionGroupOptionGroupIOptionGroup= no option group#parameterGroupIParameterGroupparameter_groupIParameterGroupparameterGroupIParameterGroupParameterGroupIParameterGroupParameterGroupIParameterGroup= no parameter group#performanceInsightEncryptionKeyIKeyRefperformance_insight_encryption_keyIKeyRefperformanceInsightEncryptionKeyIKeyRefPerformanceInsightEncryptionKeyIKeyRefPerformanceInsightEncryptionKeyIKeyRef= default master key#performanceInsightRetentionPerformanceInsightRetentionperformance_insight_retentionPerformanceInsightRetentionperformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetention= 7 this is the free tier#If you set databaseInsightsMode to DatabaseInsightsMode.ADVANCED, you must set this property to PerformanceInsightRetention.MONTHS_15.
default
Default: the default port for the chosen engine.
preferredBackupWindowstringpreferred_backup_windowstrpreferredBackupWindowStringPreferredBackupWindowstringPreferredBackupWindow*string= a 30-minute window selected at r…#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.
default
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
preferredMaintenanceWindowstringpreferred_maintenance_windowstrpreferredMaintenanceWindowStringPreferredMaintenanceWindowstringPreferredMaintenanceWindow*string= a 30-minute window selected at r…#Format: ddd:hh24:mi-ddd:hh24:mi Constraint: Minimum 30-minute window
default
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
processorFeaturesProcessorFeaturesprocessor_featuresProcessorFeaturesprocessorFeaturesProcessorFeaturesProcessorFeaturesProcessorFeaturesProcessorFeaturesProcessorFeatures= the default number of CPU cores …#default
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
publiclyAccessiblebooleanpublicly_accessibleboolpubliclyAccessibleBooleanPubliclyAccessibleboolPubliclyAccessible*bool= `true` if the instance's `vpcSub…#If not specified, the instance's vpcSubnets will be used to determine if the instance is internet-facing or not.
default
Default: true if the instance's vpcSubnets is subnetType: SubnetType.PUBLIC, false otherwise
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.SNAPSHOT (remove t…#default
Default: RemovalPolicy.SNAPSHOT (remove the resource, but retain a snapshot of the data)
s3ExportBucketsIBucket[]s3_export_bucketstyping.List[IBucket]s3ExportBucketsList<IBucket>S3ExportBucketsIBucket[]S3ExportBuckets*[]IBucket= None#This property must not be used if s3ExportRole is used.
For Microsoft SQL Server:
s3ExportRoleIRoles3_export_roleIRoles3ExportRoleIRoleS3ExportRoleIRoleS3ExportRoleIRole= New role is created if `s3Export…#This property must not be used if s3ExportBuckets is used.
For Microsoft SQL Server:
default
Default: New role is created if s3ExportBuckets is set, no role is defined otherwise
s3ImportBucketsIBucket[]s3_import_bucketstyping.List[IBucket]s3ImportBucketsList<IBucket>S3ImportBucketsIBucket[]S3ImportBuckets*[]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:
s3ImportRoleIRoles3_import_roleIRoles3ImportRoleIRoleS3ImportRoleIRoleS3ImportRoleIRole= New role is created if `s3Import…#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:
default
Default: New role is created if s3ImportBuckets is set, no role is defined otherwise
securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= 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.
storageEncryptedbooleanstorage_encryptedboolstorageEncryptedBooleanStorageEncryptedboolStorageEncrypted*bool= true if storageEncryptionKey has…#default
Default: true if storageEncryptionKey has been provided, false otherwise
storageEncryptionKeyIKeyRefstorage_encryption_keyIKeyRefstorageEncryptionKeyIKeyRefStorageEncryptionKeyIKeyRefStorageEncryptionKeyIKeyRef= default master key if storageEnc…#default
Default: default master key if storageEncrypted is true, no key otherwise
storageThroughputnumberstorage_throughputint | floatstorageThroughputNumberStorageThroughputdoubleStorageThroughput*float64= 125 MiBps if allocated storage i…#Only applicable for GP3.
default
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).
storageTypeStorageTypestorage_typeStorageTypestorageTypeStorageTypeStorageTypeStorageTypeStorageTypeStorageType= StorageType.GP2#Storage types supported are gp2, gp3, io1, io2, and standard.
subnetGroupIDBSubnetGroupRefsubnet_groupIDBSubnetGroupRefsubnetGroupIDBSubnetGroupRefSubnetGroupIDBSubnetGroupRefSubnetGroupIDBSubnetGroupRef= a new subnet group will be creat…#default
Default: a new subnet group will be created.
vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection= 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#engineIInstanceEngineengineIInstanceEngineengineIInstanceEngineEngineIInstanceEngineEngineIInstanceEngine#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#instanceResourceIdstringinstance_resource_idstrinstanceResourceIdStringInstanceResourceIdstringInstanceResourceId*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.