Class DatabaseCluster.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<DatabaseCluster>
- Enclosing class:
DatabaseCluster
DatabaseCluster
.-
Method Summary
Modifier and TypeMethodDescriptionautoMinorVersionUpgrade
(Boolean autoMinorVersionUpgrade) Specifies whether minor engine upgrades are applied automatically to the DB cluster during the maintenance window.backtrackWindow
(Duration backtrackWindow) The number of seconds to set a cluster's target backtrack window to.backup
(BackupProps backup) Backup settings.build()
cloudwatchLogsExports
(List<String> cloudwatchLogsExports) The list of log types that need to be enabled for exporting to CloudWatch Logs.cloudwatchLogsRetention
(RetentionDays cloudwatchLogsRetention) The number of days log events are kept in CloudWatch Logs.cloudwatchLogsRetentionRole
(IRole cloudwatchLogsRetentionRole) The IAM role for the Lambda function associated with the custom resource that sets the retention policy.clusterIdentifier
(String clusterIdentifier) An optional identifier for the cluster.copyTagsToSnapshot
(Boolean copyTagsToSnapshot) Whether to copy tags to the snapshot when a snapshot is created.static DatabaseCluster.Builder
credentials
(Credentials credentials) Credentials for the administrative user.defaultDatabaseName
(String defaultDatabaseName) Name of a database which is automatically created inside the cluster.deletionProtection
(Boolean deletionProtection) Indicates whether the DB cluster should have deletion protection enabled.Directory ID for associating the DB cluster with a specific Active Directory.domainRole
(IRole domainRole) The IAM role to be used when making API calls to the Directory Service.enableDataApi
(Boolean enableDataApi) Whether to enable the Data API for the cluster.enableLocalWriteForwarding
(Boolean enableLocalWriteForwarding) Whether read replicas can forward write operations to the writer DB instance in the DB cluster.enablePerformanceInsights
(Boolean enablePerformanceInsights) Whether to enable Performance Insights for the DB cluster.engine
(IClusterEngine engine) What kind of database to start.iamAuthentication
(Boolean iamAuthentication) Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.instanceIdentifierBase
(String instanceIdentifierBase) Base identifier for instances.instanceProps
(InstanceProps instanceProps) Deprecated.use writer and readers insteadDeprecated.use writer and readers insteadinstanceUpdateBehaviour
(InstanceUpdateBehaviour instanceUpdateBehaviour) The ordering of updates for instances.monitoringInterval
(Duration monitoringInterval) The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances.monitoringRole
(IRole monitoringRole) Role that will be used to manage DB instances monitoring.networkType
(NetworkType networkType) The network type of the DB instance.parameterGroup
(IParameterGroup parameterGroup) Additional parameters to pass to the database engine.parameters
(Map<String, String> parameters) The parameters in the DBClusterParameterGroup to create automatically.performanceInsightEncryptionKey
(IKey performanceInsightEncryptionKey) The AWS KMS key for encryption of Performance Insights data.performanceInsightRetention
(PerformanceInsightRetention performanceInsightRetention) The amount of time, in days, to retain Performance Insights data.What port to listen on.preferredMaintenanceWindow
(String preferredMaintenanceWindow) A preferred maintenance window day/time range.readers
(List<? extends IClusterInstance> readers) A list of instances to create as cluster reader instances.removalPolicy
(RemovalPolicy removalPolicy) The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.s3ExportBuckets
(List<? extends IBucket> s3ExportBuckets) S3 buckets that you want to load data into.s3ExportRole
(IRole s3ExportRole) Role that will be associated with this DB cluster to enable S3 export.s3ImportBuckets
(List<? extends IBucket> s3ImportBuckets) S3 buckets that you want to load data from.s3ImportRole
(IRole s3ImportRole) Role that will be associated with this DB cluster to enable S3 import.securityGroups
(List<? extends ISecurityGroup> securityGroups) Security group.serverlessV2MaxCapacity
(Number serverlessV2MaxCapacity) The maximum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.serverlessV2MinCapacity
(Number serverlessV2MinCapacity) The minimum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.storageEncrypted
(Boolean storageEncrypted) Whether to enable storage encryption.storageEncryptionKey
(IKey storageEncryptionKey) The KMS key for storage encryption.storageType
(DBClusterStorageType storageType) The storage type to be associated with the DB cluster.subnetGroup
(ISubnetGroup subnetGroup) Existing subnet group for the cluster.What subnets to run the RDS instances in.vpcSubnets
(SubnetSelection vpcSubnets) Where to place the instances within the VPC.writer
(IClusterInstance writer) The instance to use for the cluster writer.
-
Method Details
-
create
@Stability(Stable) public static DatabaseCluster.Builder create(software.constructs.Construct scope, String id) - Parameters:
scope
- This parameter is required.id
- This parameter is required.- Returns:
- a new instance of
DatabaseCluster.Builder
.
-
engine
What kind of database to start.- Parameters:
engine
- What kind of database to start. This parameter is required.- Returns:
this
-
autoMinorVersionUpgrade
@Stability(Stable) public DatabaseCluster.Builder autoMinorVersionUpgrade(Boolean autoMinorVersionUpgrade) Specifies whether minor engine upgrades are applied automatically to the DB cluster during the maintenance window.Default: true
- Parameters:
autoMinorVersionUpgrade
- Specifies whether minor engine upgrades are applied automatically to the DB cluster during the maintenance window. This parameter is required.- Returns:
this
-
backtrackWindow
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.
Default: 0 seconds (no backtrack)
- Parameters:
backtrackWindow
- The number of seconds to set a cluster's target backtrack window to. This parameter is required.- Returns:
this
- See Also:
-
backup
Backup settings.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.
- Parameters:
backup
- Backup settings. This parameter is required.- Returns:
this
- See Also:
-
cloudwatchLogsExports
@Stability(Stable) public DatabaseCluster.Builder cloudwatchLogsExports(List<String> cloudwatchLogsExports) The list of log types that need to be enabled for exporting to CloudWatch Logs.Default: - no log exports
- Parameters:
cloudwatchLogsExports
- The list of log types that need to be enabled for exporting to CloudWatch Logs. This parameter is required.- Returns:
this
-
cloudwatchLogsRetention
@Stability(Stable) public DatabaseCluster.Builder cloudwatchLogsRetention(RetentionDays cloudwatchLogsRetention) 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
.Default: - logs never expire
- Parameters:
cloudwatchLogsRetention
- The number of days log events are kept in CloudWatch Logs. This parameter is required.- Returns:
this
-
cloudwatchLogsRetentionRole
@Stability(Stable) public DatabaseCluster.Builder cloudwatchLogsRetentionRole(IRole cloudwatchLogsRetentionRole) The IAM role for the Lambda function associated with the custom resource that sets the retention policy.Default: - a new role is created.
- Parameters:
cloudwatchLogsRetentionRole
- The IAM role for the Lambda function associated with the custom resource that sets the retention policy. This parameter is required.- Returns:
this
-
clusterIdentifier
An optional identifier for the cluster.Default: - A name is automatically generated.
- Parameters:
clusterIdentifier
- An optional identifier for the cluster. This parameter is required.- Returns:
this
-
copyTagsToSnapshot
Whether to copy tags to the snapshot when a snapshot is created.Default: - true
- Parameters:
copyTagsToSnapshot
- Whether to copy tags to the snapshot when a snapshot is created. This parameter is required.- Returns:
this
-
credentials
Credentials for the administrative user.Default: - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password
- Parameters:
credentials
- Credentials for the administrative user. This parameter is required.- Returns:
this
-
defaultDatabaseName
Name of a database which is automatically created inside the cluster.Default: - Database is not created in cluster.
- Parameters:
defaultDatabaseName
- Name of a database which is automatically created inside the cluster. This parameter is required.- Returns:
this
-
deletionProtection
Indicates whether the DB cluster should have deletion protection enabled.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`.
- Parameters:
deletionProtection
- Indicates whether the DB cluster should have deletion protection enabled. This parameter is required.- Returns:
this
-
domain
Directory ID for associating the DB cluster with a specific Active Directory.Necessary for enabling Kerberos authentication. If specified, the DB cluster joins the given Active Directory, enabling Kerberos authentication. If not specified, the DB cluster will not be associated with any Active Directory, and Kerberos authentication will not be enabled.
Default: - DB cluster is not associated with an Active Directory; Kerberos authentication is not enabled.
- Parameters:
domain
- Directory ID for associating the DB cluster with a specific Active Directory. This parameter is required.- Returns:
this
-
domainRole
The IAM role to be used when making API calls to the Directory Service.The role needs the AWS-managed policy
AmazonRDSDirectoryServiceAccess
or equivalent.Default: - If `DatabaseClusterBaseProps.domain` is specified, a role with the `AmazonRDSDirectoryServiceAccess` policy is automatically created.
- Parameters:
domainRole
- The IAM role to be used when making API calls to the Directory Service. This parameter is required.- Returns:
this
-
enableDataApi
Whether to enable the Data API for the cluster.Default: - false
- Parameters:
enableDataApi
- Whether to enable the Data API for the cluster. This parameter is required.- Returns:
this
-
enableLocalWriteForwarding
@Stability(Stable) public DatabaseCluster.Builder enableLocalWriteForwarding(Boolean enableLocalWriteForwarding) Whether read replicas can forward write operations to the writer DB instance in the DB cluster.This setting can only be enabled for Aurora MySQL 3.04 or higher, and for Aurora PostgreSQL 16.4 or higher (for version 16), 15.8 or higher (for version 15), and 14.13 or higher (for version 14).
Default: false
- Parameters:
enableLocalWriteForwarding
- Whether read replicas can forward write operations to the writer DB instance in the DB cluster. This parameter is required.- Returns:
this
- See Also:
-
enablePerformanceInsights
@Stability(Stable) public DatabaseCluster.Builder enablePerformanceInsights(Boolean enablePerformanceInsights) Whether to enable Performance Insights for the DB cluster.Default: - false, unless `performanceInsightRetention` or `performanceInsightEncryptionKey` is set.
- Parameters:
enablePerformanceInsights
- Whether to enable Performance Insights for the DB cluster. This parameter is required.- Returns:
this
-
iamAuthentication
Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.Default: false
- Parameters:
iamAuthentication
- Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. This parameter is required.- Returns:
this
-
instanceIdentifierBase
@Stability(Stable) public DatabaseCluster.Builder instanceIdentifierBase(String instanceIdentifierBase) Base identifier for instances.Every replica is named by appending the replica number to this string, 1-based.
Default: - clusterIdentifier is used with the word "Instance" appended. If clusterIdentifier is not provided, the identifier is automatically generated.
- Parameters:
instanceIdentifierBase
- Base identifier for instances. This parameter is required.- Returns:
this
-
instanceProps
@Stability(Deprecated) @Deprecated public DatabaseCluster.Builder instanceProps(InstanceProps instanceProps) Deprecated.- use writer and readers instead
(deprecated) Settings for the individual instances that are launched.- Parameters:
instanceProps
- Settings for the individual instances that are launched. This parameter is required.- Returns:
this
-
instances
Deprecated.- use writer and readers instead
(deprecated) How many replicas/instances to create.Has to be at least 1.
Default: 2
- Parameters:
instances
- How many replicas/instances to create. This parameter is required.- Returns:
this
-
instanceUpdateBehaviour
@Stability(Stable) public DatabaseCluster.Builder instanceUpdateBehaviour(InstanceUpdateBehaviour instanceUpdateBehaviour) The ordering of updates for instances.Default: InstanceUpdateBehaviour.BULK
- Parameters:
instanceUpdateBehaviour
- The ordering of updates for instances. This parameter is required.- Returns:
this
-
monitoringInterval
The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances.Default: no enhanced monitoring
- Parameters:
monitoringInterval
- The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances. This parameter is required.- Returns:
this
-
monitoringRole
Role that will be used to manage DB instances monitoring.Default: - A role is automatically created for you
- Parameters:
monitoringRole
- Role that will be used to manage DB instances monitoring. This parameter is required.- Returns:
this
-
networkType
The network type of the DB instance.Default: - IPV4
- Parameters:
networkType
- The network type of the DB instance. This parameter is required.- Returns:
this
-
parameterGroup
Additional parameters to pass to the database engine.Default: - No parameter group.
- Parameters:
parameterGroup
- Additional parameters to pass to the database engine. This parameter is required.- Returns:
this
-
parameters
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.
Default: - None
- Parameters:
parameters
- The parameters in the DBClusterParameterGroup to create automatically. This parameter is required.- Returns:
this
-
performanceInsightEncryptionKey
@Stability(Stable) public DatabaseCluster.Builder performanceInsightEncryptionKey(IKey performanceInsightEncryptionKey) The AWS KMS key for encryption of Performance Insights data.Default: - default master key
- Parameters:
performanceInsightEncryptionKey
- The AWS KMS key for encryption of Performance Insights data. This parameter is required.- Returns:
this
-
performanceInsightRetention
@Stability(Stable) public DatabaseCluster.Builder performanceInsightRetention(PerformanceInsightRetention performanceInsightRetention) The amount of time, in days, to retain Performance Insights data.Default: 7
- Parameters:
performanceInsightRetention
- The amount of time, in days, to retain Performance Insights data. This parameter is required.- Returns:
this
-
port
What port to listen on.Default: - The default for the engine is used.
- Parameters:
port
- What port to listen on. This parameter is required.- Returns:
this
-
preferredMaintenanceWindow
@Stability(Stable) public DatabaseCluster.Builder preferredMaintenanceWindow(String preferredMaintenanceWindow) 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'
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.
- Parameters:
preferredMaintenanceWindow
- A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). This parameter is required.- Returns:
this
- See Also:
-
readers
A list of instances to create as cluster reader instances.Default: - no readers are created. The cluster will have a single writer/reader
- Parameters:
readers
- A list of instances to create as cluster reader instances. This parameter is required.- Returns:
this
-
removalPolicy
The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.Default: - RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data)
- Parameters:
removalPolicy
- The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update. This parameter is required.- Returns:
this
-
s3ExportBuckets
@Stability(Stable) public DatabaseCluster.Builder s3ExportBuckets(List<? extends IBucket> s3ExportBuckets) 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:
Default: - None
- Parameters:
s3ExportBuckets
- S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine. This parameter is required.- Returns:
this
- See Also:
-
s3ExportRole
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. To use this property with Aurora PostgreSQL, it must be configured with the S3 export feature enabled when creating the DatabaseClusterEngine For MySQL:Default: - New role is created if `s3ExportBuckets` is set, no role is defined otherwise
- Parameters:
s3ExportRole
- Role that will be associated with this DB cluster to enable S3 export. This parameter is required.- Returns:
this
- See Also:
-
s3ImportBuckets
@Stability(Stable) public DatabaseCluster.Builder s3ImportBuckets(List<? extends IBucket> s3ImportBuckets) 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:
Default: - None
- Parameters:
s3ImportBuckets
- S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine. This parameter is required.- Returns:
this
- See Also:
-
s3ImportRole
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. To use this property with Aurora PostgreSQL, it must be configured with the S3 import feature enabled when creating the DatabaseClusterEngine For MySQL:Default: - New role is created if `s3ImportBuckets` is set, no role is defined otherwise
- Parameters:
s3ImportRole
- Role that will be associated with this DB cluster to enable S3 import. This parameter is required.- Returns:
this
- See Also:
-
securityGroups
@Stability(Stable) public DatabaseCluster.Builder securityGroups(List<? extends ISecurityGroup> securityGroups) Security group.Default: a new security group is created.
- Parameters:
securityGroups
- Security group. This parameter is required.- Returns:
this
-
serverlessV2MaxCapacity
@Stability(Stable) public DatabaseCluster.Builder serverlessV2MaxCapacity(Number serverlessV2MaxCapacity) 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 256.
The maximum capacity must be higher than 0.5 ACUs.
Default: 2
- Parameters:
serverlessV2MaxCapacity
- The maximum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster. This parameter is required.- Returns:
this
- See Also:
-
serverlessV2MinCapacity
@Stability(Stable) public DatabaseCluster.Builder serverlessV2MinCapacity(Number serverlessV2MinCapacity) 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.
Default: 0.5
- Parameters:
serverlessV2MinCapacity
- The minimum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster. This parameter is required.- Returns:
this
- See Also:
-
storageEncrypted
Whether to enable storage encryption.Default: - true if storageEncryptionKey is provided, false otherwise
- Parameters:
storageEncrypted
- Whether to enable storage encryption. This parameter is required.- Returns:
this
-
storageEncryptionKey
The KMS key for storage encryption.If specified,
storageEncrypted
will be set totrue
.Default: - if storageEncrypted is true then the default master key, no key otherwise
- Parameters:
storageEncryptionKey
- The KMS key for storage encryption. This parameter is required.- Returns:
this
-
storageType
The storage type to be associated with the DB cluster.Default: - DBClusterStorageType.AURORA_IOPT1
- Parameters:
storageType
- The storage type to be associated with the DB cluster. This parameter is required.- Returns:
this
-
subnetGroup
Existing subnet group for the cluster.Default: - a new subnet group will be created.
- Parameters:
subnetGroup
- Existing subnet group for the cluster. This parameter is required.- Returns:
this
-
vpc
What subnets to run the RDS instances in.Must be at least 2 subnets in two different AZs.
- Parameters:
vpc
- What subnets to run the RDS instances in. This parameter is required.- Returns:
this
-
vpcSubnets
Where to place the instances within the VPC.Default: - the Vpc default strategy if not specified.
- Parameters:
vpcSubnets
- Where to place the instances within the VPC. This parameter is required.- Returns:
this
-
writer
The instance to use for the cluster writer.Default: required if instanceProps is not provided
- Parameters:
writer
- The instance to use for the cluster writer. This parameter is required.- Returns:
this
-
build
- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<DatabaseCluster>
- Returns:
- a newly built instance of
DatabaseCluster
.
-