aws-cdk-lib.aws_rds.DatabaseClusterProps

interface DatabaseClusterProps

LanguageType name
.NETAmazon.CDK.AWS.RDS.DatabaseClusterProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsrds#DatabaseClusterProps
Javasoftware.amazon.awscdk.services.rds.DatabaseClusterProps
Pythonaws_cdk.aws_rds.DatabaseClusterProps
TypeScript (source)aws-cdk-lib » aws_rds » DatabaseClusterProps

Properties for a new database cluster.

Example

declare const vpc: ec2.Vpc;
const cluster = new rds.DatabaseCluster(this, 'Database', {
  engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }),
  writer: rds.ClusterInstance.provisioned('writer', {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.XLARGE4),
  }),
  serverlessV2MinCapacity: 6.5,
  serverlessV2MaxCapacity: 64,
  readers: [
    // will be put in promotion tier 1 and will scale with the writer
    rds.ClusterInstance.serverlessV2('reader1', { scaleWithWriter: true }),
    // will be put in promotion tier 2 and will not scale with the writer
    rds.ClusterInstance.serverlessV2('reader2'),
  ]
  vpc,
});

Properties

NameTypeDescription
engineIClusterEngineWhat kind of database to start.
backtrackWindow?DurationThe number of seconds to set a cluster's target backtrack window to.
backup?BackupPropsBackup settings.
cloudwatchLogsExports?string[]The list of log types that need to be enabled for exporting to CloudWatch Logs.
cloudwatchLogsRetention?RetentionDaysThe number of days log events are kept in CloudWatch Logs.
cloudwatchLogsRetentionRole?IRoleThe IAM role for the Lambda function associated with the custom resource that sets the retention policy.
clusterIdentifier?stringAn optional identifier for the cluster.
copyTagsToSnapshot?booleanWhether to copy tags to the snapshot when a snapshot is created.
credentials?CredentialsCredentials for the administrative user.
defaultDatabaseName?stringName of a database which is automatically created inside the cluster.
deletionProtection?booleanIndicates whether the DB cluster should have deletion protection enabled.
iamAuthentication?booleanWhether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.
instanceIdentifierBase?stringBase identifier for instances.
instanceProps?⚠️InstancePropsSettings for the individual instances that are launched.
instanceUpdateBehaviour?InstanceUpdateBehaviourThe ordering of updates for instances.
instances?⚠️numberHow many replicas/instances to create.
monitoringInterval?DurationThe interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances.
monitoringRole?IRoleRole that will be used to manage DB instances monitoring.
networkType?NetworkTypeThe network type of the DB instance.
parameterGroup?IParameterGroupAdditional parameters to pass to the database engine.
parameters?{ [string]: string }The parameters in the DBClusterParameterGroup to create automatically.
port?numberWhat port to listen on.
preferredMaintenanceWindow?stringA preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).
readers?IClusterInstance[]A list of instances to create as cluster reader instances.
removalPolicy?RemovalPolicyThe removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.
s3ExportBuckets?IBucket[]S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine.
s3ExportRole?IRoleRole that will be associated with this DB cluster to enable S3 export.
s3ImportBuckets?IBucket[]S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine.
s3ImportRole?IRoleRole that will be associated with this DB cluster to enable S3 import.
securityGroups?ISecurityGroup[]Security group.
serverlessV2MaxCapacity?numberThe maximum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.
serverlessV2MinCapacity?numberThe minimum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.
storageEncrypted?booleanWhether to enable storage encryption.
storageEncryptionKey?IKeyThe KMS key for storage encryption.
storageType?DBClusterStorageTypeThe storage type to be associated with the DB cluster.
subnetGroup?ISubnetGroupExisting subnet group for the cluster.
vpc?IVpcWhat subnets to run the RDS instances in.
vpcSubnets?SubnetSelectionWhere to place the instances within the VPC.
writer?IClusterInstanceThe instance to use for the cluster writer.

engine

Type: IClusterEngine

What kind of database to start.


backtrackWindow?

Type: Duration (optional, default: 0 seconds (no backtrack))

The number of seconds to set a cluster's target backtrack window to.

This feature is only supported by the Aurora MySQL database engine and cannot be enabled on existing clusters.

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html


backup?

Type: BackupProps (optional, default: Backup retention period for automated backups is 1 day. Backup preferred window is set to 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.)

Backup settings.

See also: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow


cloudwatchLogsExports?

Type: string[] (optional, default: no log exports)

The list of log types that need to be enabled for exporting to CloudWatch Logs.


cloudwatchLogsRetention?

Type: RetentionDays (optional, default: logs never expire)

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

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


cloudwatchLogsRetentionRole?

Type: IRole (optional, default: a new role is created.)

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


clusterIdentifier?

Type: string (optional, default: A name is automatically generated.)

An optional identifier for the cluster.


copyTagsToSnapshot?

Type: boolean (optional, default: true)

Whether to copy tags to the snapshot when a snapshot is created.


credentials?

Type: Credentials (optional, default: A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password)

Credentials for the administrative user.


defaultDatabaseName?

Type: string (optional, default: Database is not created in cluster.)

Name of a database which is automatically created inside the cluster.


deletionProtection?

Type: boolean (optional, default: true if removalPolicy is RETAIN, undefined otherwise, which will not enable deletion protection. To disable deletion protection after it has been enabled, you must explicitly set this value to false.)

Indicates whether the DB cluster should have deletion protection enabled.


iamAuthentication?

Type: boolean (optional, default: false)

Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.


instanceIdentifierBase?

Type: string (optional, default: clusterIdentifier is used with the word "Instance" appended. If clusterIdentifier is not provided, the identifier is automatically generated.)

Base identifier for instances.

Every replica is named by appending the replica number to this string, 1-based.


instanceProps?⚠️

⚠️ Deprecated: - use writer and readers instead

Type: InstanceProps (optional)

Settings for the individual instances that are launched.


instanceUpdateBehaviour?

Type: InstanceUpdateBehaviour (optional, default: InstanceUpdateBehaviour.BULK)

The ordering of updates for instances.


instances?⚠️

⚠️ Deprecated: - use writer and readers instead

Type: number (optional, default: 2)

How many replicas/instances to create.

Has to be at least 1.


monitoringInterval?

Type: Duration (optional, default: no enhanced monitoring)

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


monitoringRole?

Type: IRole (optional, default: A role is automatically created for you)

Role that will be used to manage DB instances monitoring.


networkType?

Type: NetworkType (optional, default: IPV4)

The network type of the DB instance.


parameterGroup?

Type: IParameterGroup (optional, default: No parameter group.)

Additional parameters to pass to the database engine.


parameters?

Type: { [string]: string } (optional, default: None)

The parameters in the DBClusterParameterGroup to create automatically.

You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBClusterParameterGroup.


port?

Type: number (optional, default: The default for the engine is used.)

What port to listen on.


preferredMaintenanceWindow?

Type: string (optional, default: 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.)

A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).

Example: 'Sun:23:45-Mon:00:15'

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance


readers?

Type: IClusterInstance[] (optional, default: no readers are created. The cluster will have a single writer/reader)

A list of instances to create as cluster reader instances.


removalPolicy?

Type: RemovalPolicy (optional, default: RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data))

The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.


s3ExportBuckets?

Type: IBucket[] (optional, default: None)

S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine.

This property must not be used if s3ExportRole is used.

For MySQL:

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html


s3ExportRole?

Type: IRole (optional, default: New role is created if s3ExportBuckets is set, no role is defined otherwise)

Role that will be associated with this DB cluster to enable S3 export.

This feature is only supported by the Aurora database engine.

This property must not be used if s3ExportBuckets is used.

For MySQL:

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html


s3ImportBuckets?

Type: IBucket[] (optional, default: None)

S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine.

This property must not be used if s3ImportRole is used.

For MySQL:

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html


s3ImportRole?

Type: IRole (optional, default: New role is created if s3ImportBuckets is set, no role is defined otherwise)

Role that will be associated with this DB cluster to enable S3 import.

This feature is only supported by the Aurora database engine.

This property must not be used if s3ImportBuckets is used.

For MySQL:

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html


securityGroups?

Type: ISecurityGroup[] (optional, default: a new security group is created.)

Security group.


serverlessV2MaxCapacity?

Type: number (optional, default: 2)

The maximum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.

You can specify ACU values in half-step increments, such as 40, 40.5, 41, and so on. The largest value that you can use is 128 (256GB).

The maximum capacity must be higher than 0.5 ACUs.

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.setting-capacity.html#aurora-serverless-v2.max_capacity_considerations


serverlessV2MinCapacity?

Type: number (optional, default: 0.5)

The minimum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.

You can specify ACU values in half-step increments, such as 8, 8.5, 9, and so on. The smallest value that you can use is 0.5.

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.setting-capacity.html#aurora-serverless-v2.max_capacity_considerations


storageEncrypted?

Type: boolean (optional, default: true if storageEncryptionKey is provided, false otherwise)

Whether to enable storage encryption.


storageEncryptionKey?

Type: IKey (optional, default: if storageEncrypted is true then the default master key, no key otherwise)

The KMS key for storage encryption.

If specified, storageEncrypted will be set to true.


storageType?

Type: DBClusterStorageType (optional, default: DBClusterStorageType.AURORA_IOPT1)

The storage type to be associated with the DB cluster.


subnetGroup?

Type: ISubnetGroup (optional, default: a new subnet group will be created.)

Existing subnet group for the cluster.


vpc?

Type: IVpc (optional)

What subnets to run the RDS instances in.

Must be at least 2 subnets in two different AZs.


vpcSubnets?

Type: SubnetSelection (optional, default: the Vpc default strategy if not specified.)

Where to place the instances within the VPC.


writer?

Type: IClusterInstance (optional, default: required if instanceProps is not provided)

The instance to use for the cluster writer.