Class CfnDBInstancePropsMixin
- All Implemented Interfaces:
IMixin,software.amazon.jsii.JsiiSerializable
AWS::RDS::DBInstance resource creates an Amazon DB instance.
The new DB instance can be an RDS DB instance, or it can be a DB instance in an Aurora DB cluster.
For more information about creating an RDS DB instance, see Creating an Amazon RDS DB instance in the Amazon RDS User Guide .
For more information about creating a DB instance in an Aurora DB cluster, see Creating an Amazon Aurora DB cluster in the Amazon Aurora User Guide .
If you import an existing DB instance, and the template configuration doesn't match the actual configuration of the DB instance, AWS CloudFormation applies the changes in the template during the import operation.
If a DB instance is deleted or replaced during an update, AWS CloudFormation deletes all automated snapshots. However, it retains manual DB snapshots. During an update that requires replacement, you can apply a stack policy to prevent DB instances from being replaced. For more information, see Prevent Updates to Stack Resources .
Updating DB instances
When properties labeled " Update requires: Replacement " are updated, AWS CloudFormation first creates a replacement DB instance, then changes references from other dependent resources to point to the replacement DB instance, and finally deletes the old DB instance.
We highly recommend that you take a snapshot of the database before updating the stack. If you don't, you lose the data when AWS CloudFormation replaces your DB instance. To preserve your data, perform the following procedure:
- Deactivate any applications that are using the DB instance so that there's no activity on the DB instance.
- Create a snapshot of the DB instance. For more information, see Creating a DB Snapshot .
- If you want to restore your instance using a DB snapshot, modify the updated template with your DB instance changes and add the
DBSnapshotIdentifierproperty with the ID of the DB snapshot that you want to use.After you restore a DB instance with a
DBSnapshotIdentifierproperty, you can delete theDBSnapshotIdentifierproperty. When you specify this property for an update, the DB instance is not restored from the DB snapshot again, and the data in the database is not changed. However, if you don't specify theDBSnapshotIdentifierproperty, an empty DB instance is created, and the original DB instance is deleted. If you specify a property that is different from the previous snapshot restore property, a new DB instance is restored from the specifiedDBSnapshotIdentifierproperty, and the original DB instance is deleted.
- Update the stack.
For more information about updating other properties of this resource, see [ModifyDBInstance](https://docs.aws.amazon.com//AmazonRDS/latest/APIReference/API_ModifyDBInstance.html) . For more information about updating stacks, see AWS CloudFormation Stacks Updates .
Deleting DB instances
For DB instances that are part of an Aurora DB cluster, you can set a deletion policy for your DB instance to control how AWS CloudFormation handles the DB instance when the stack is deleted. For Amazon RDS DB instances, you can choose to retain the DB instance, to delete the DB instance, or to create a snapshot of the DB instance. The default AWS CloudFormation behavior depends on the DBClusterIdentifier property:
- For
AWS::RDS::DBInstanceresources that don't specify theDBClusterIdentifierproperty, AWS CloudFormation saves a snapshot of the DB instance. - For
AWS::RDS::DBInstanceresources that do specify theDBClusterIdentifierproperty, AWS CloudFormation deletes the DB instance.
For more information, see DeletionPolicy Attribute .
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.mixins.preview.mixins.*;
import software.amazon.awscdk.mixins.preview.services.rds.mixins.*;
CfnDBInstancePropsMixin cfnDBInstancePropsMixin = CfnDBInstancePropsMixin.Builder.create(CfnDBInstanceMixinProps.builder()
.allocatedStorage("allocatedStorage")
.allowMajorVersionUpgrade(false)
.applyImmediately(false)
.associatedRoles(List.of(DBInstanceRoleProperty.builder()
.featureName("featureName")
.roleArn("roleArn")
.build()))
.automaticBackupReplicationKmsKeyId("automaticBackupReplicationKmsKeyId")
.automaticBackupReplicationRegion("automaticBackupReplicationRegion")
.automaticBackupReplicationRetentionPeriod(123)
.autoMinorVersionUpgrade(false)
.availabilityZone("availabilityZone")
.backupRetentionPeriod(123)
.backupTarget("backupTarget")
.caCertificateIdentifier("caCertificateIdentifier")
.certificateRotationRestart(false)
.characterSetName("characterSetName")
.copyTagsToSnapshot(false)
.customIamInstanceProfile("customIamInstanceProfile")
.databaseInsightsMode("databaseInsightsMode")
.dbClusterIdentifier("dbClusterIdentifier")
.dbClusterSnapshotIdentifier("dbClusterSnapshotIdentifier")
.dbInstanceClass("dbInstanceClass")
.dbInstanceIdentifier("dbInstanceIdentifier")
.dbName("dbName")
.dbParameterGroupName("dbParameterGroupName")
.dbSecurityGroups(List.of("dbSecurityGroups"))
.dbSnapshotIdentifier("dbSnapshotIdentifier")
.dbSubnetGroupName("dbSubnetGroupName")
.dbSystemId("dbSystemId")
.dedicatedLogVolume(false)
.deleteAutomatedBackups(false)
.deletionProtection(false)
.domain("domain")
.domainAuthSecretArn("domainAuthSecretArn")
.domainDnsIps(List.of("domainDnsIps"))
.domainFqdn("domainFqdn")
.domainIamRoleName("domainIamRoleName")
.domainOu("domainOu")
.enableCloudwatchLogsExports(List.of("enableCloudwatchLogsExports"))
.enableIamDatabaseAuthentication(false)
.enablePerformanceInsights(false)
.engine("engine")
.engineLifecycleSupport("engineLifecycleSupport")
.engineVersion("engineVersion")
.iops(123)
.kmsKeyId("kmsKeyId")
.licenseModel("licenseModel")
.manageMasterUserPassword(false)
.masterUserAuthenticationType("masterUserAuthenticationType")
.masterUsername("masterUsername")
.masterUserPassword("masterUserPassword")
.masterUserSecret(MasterUserSecretProperty.builder()
.kmsKeyId("kmsKeyId")
.secretArn("secretArn")
.build())
.maxAllocatedStorage(123)
.monitoringInterval(123)
.monitoringRoleArn("monitoringRoleArn")
.multiAz(false)
.ncharCharacterSetName("ncharCharacterSetName")
.networkType("networkType")
.optionGroupName("optionGroupName")
.performanceInsightsKmsKeyId("performanceInsightsKmsKeyId")
.performanceInsightsRetentionPeriod(123)
.port("port")
.preferredBackupWindow("preferredBackupWindow")
.preferredMaintenanceWindow("preferredMaintenanceWindow")
.processorFeatures(List.of(ProcessorFeatureProperty.builder()
.name("name")
.value("value")
.build()))
.promotionTier(123)
.publiclyAccessible(false)
.replicaMode("replicaMode")
.restoreTime("restoreTime")
.sourceDbClusterIdentifier("sourceDbClusterIdentifier")
.sourceDbInstanceAutomatedBackupsArn("sourceDbInstanceAutomatedBackupsArn")
.sourceDbInstanceIdentifier("sourceDbInstanceIdentifier")
.sourceDbiResourceId("sourceDbiResourceId")
.sourceRegion("sourceRegion")
.storageEncrypted(false)
.storageThroughput(123)
.storageType("storageType")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.tdeCredentialArn("tdeCredentialArn")
.tdeCredentialPassword("tdeCredentialPassword")
.timezone("timezone")
.useDefaultProcessorFeatures(false)
.useLatestRestorableTime(false)
.vpcSecurityGroups(List.of("vpcSecurityGroups"))
.build())
.strategy(PropertyMergeStrategy.OVERRIDE)
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnDBInstancePropsMixin.static interfaceThe details of the DB instance’s server certificate.static interfaceInformation about an AWS Identity and Access Management (IAM) role that is associated with a DB instance.static interfaceProvides a list of status information for a DB instance.static interfaceThis data type represents the information you need to connect to an Amazon RDS DB instance.static interfaceTheMasterUserSecretreturn value specifies the secret managed by RDS in AWS Secrets Manager for the master user password.static interfaceTheProcessorFeatureproperty type specifies the processor features of a DB instance class.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.mixins.preview.core.IMixin
IMixin.Jsii$Default, IMixin.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a mixin to apply properties toAWS::RDS::DBInstance.CfnDBInstancePropsMixin(CfnDBInstanceMixinProps props, CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::RDS::DBInstance.protectedCfnDBInstancePropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnDBInstancePropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionsoftware.constructs.IConstructapplyTo(software.constructs.IConstruct construct) Apply the mixin properties to the construct.protected CfnDBInstanceMixinPropsgetProps()protected PropertyMergeStrategysupports(software.constructs.IConstruct construct) Check if this mixin supports the given construct.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_PROPERTY_KEYS
-
-
Constructor Details
-
CfnDBInstancePropsMixin
protected CfnDBInstancePropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
CfnDBInstancePropsMixin
protected CfnDBInstancePropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnDBInstancePropsMixin
@Stability(Stable) public CfnDBInstancePropsMixin(@NotNull CfnDBInstanceMixinProps props, @Nullable CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::RDS::DBInstance.- Parameters:
props- L1 properties to apply. This parameter is required.options- Mixin options.
-
CfnDBInstancePropsMixin
Create a mixin to apply properties toAWS::RDS::DBInstance.- Parameters:
props- L1 properties to apply. This parameter is required.
-
-
Method Details
-
applyTo
@Stability(Stable) @NotNull public software.constructs.IConstruct applyTo(@NotNull software.constructs.IConstruct construct) Apply the mixin properties to the construct. -
supports
@Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct) Check if this mixin supports the given construct. -
getProps
-
getStrategy
-