interface DatabaseClusterProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.RDS.DatabaseClusterProps |
![]() | software.amazon.awscdk.services.rds.DatabaseClusterProps |
![]() | aws_cdk.aws_rds.DatabaseClusterProps |
![]() | @aws-cdk/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.AURORA,
instanceProps: { vpc },
});
const proxy = new rds.DatabaseProxy(this, 'Proxy', {
proxyTarget: rds.ProxyTarget.fromCluster(cluster),
secrets: [cluster.secret!],
vpc,
});
const role = new iam.Role(this, 'DBProxyRole', { assumedBy: new iam.AccountPrincipal(this.account) });
proxy.grantConnect(role, 'admin'); // Grant the role connection access to the DB Proxy for database user 'admin'.
Properties
Name | Type | Description |
---|---|---|
engine | ICluster | What kind of database to start. |
instance | Instance | Settings for the individual instances that are launched. |
backtrack | Duration | The number of seconds to set a cluster's target backtrack window to. |
backup? | Backup | Backup settings. |
cloudwatch | string[] | The list of log types that need to be enabled for exporting to CloudWatch Logs. |
cloudwatch | Retention | The number of days log events are kept in CloudWatch Logs. |
cloudwatch | IRole | The IAM role for the Lambda function associated with the custom resource that sets the retention policy. |
cluster | string | An optional identifier for the cluster. |
copy | boolean | Whether to copy tags to the snapshot when a snapshot is created. |
credentials? | Credentials | Credentials for the administrative user. |
default | string | Name of a database which is automatically created inside the cluster. |
deletion | boolean | Indicates whether the DB cluster should have deletion protection enabled. |
iam | boolean | Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. |
instance | string | Base identifier for instances. |
instances? | number | How many replicas/instances to create. |
monitoring | Duration | The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances. |
monitoring | IRole | Role that will be used to manage DB instances monitoring. |
parameter | IParameter | Additional parameters to pass to the database engine. |
parameters? | { [string]: string } | The parameters in the DBClusterParameterGroup to create automatically. |
port? | number | What port to listen on. |
preferred | string | A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). |
removal | Removal | The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update. |
s3 | IBucket [] | S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine. |
s3 | IRole | Role that will be associated with this DB cluster to enable S3 export. |
s3 | IBucket [] | S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine. |
s3 | IRole | Role that will be associated with this DB cluster to enable S3 import. |
storage | boolean | Whether to enable storage encryption. |
storage | IKey | The KMS key for storage encryption. |
subnet | ISubnet | Existing subnet group for the cluster. |
engine
Type:
ICluster
What kind of database to start.
instanceProps
Type:
Instance
Settings for the individual instances that are launched.
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.
backup?
Type:
Backup
(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.
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:
Retention
(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, false otherwise)
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.
instances?
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.
parameterGroup?
Type:
IParameter
(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'
removalPolicy?
Type:
Removal
(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:
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:
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:
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:
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, {@link storageEncrypted} will be set to true
.
subnetGroup?
Type:
ISubnet
(optional, default: a new subnet group will be created.)
Existing subnet group for the cluster.