interface DatabaseClusterProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.DocDB.DatabaseClusterProps |
Java | software.amazon.awscdk.services.docdb.DatabaseClusterProps |
Python | aws_cdk.aws_docdb.DatabaseClusterProps |
TypeScript (source) | @aws-cdk/aws-docdb » DatabaseClusterProps |
Properties for a new database cluster.
Example
declare const vpc: ec2.Vpc;
const cluster = new docdb.DatabaseCluster(this, 'Database', {
masterUser: {
username: 'myuser', // NOTE: 'admin' is reserved by DocumentDB
excludeCharacters: '\"@/:', // optional, defaults to the set "\"@/" and is also used for eventually created rotations
secretName: '/myapp/mydocdb/masteruser', // optional, if you prefer to specify the secret name
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE),
vpcSubnets: {
subnetType: ec2.SubnetType.PUBLIC,
},
vpc,
});
Properties
Name | Type | Description |
---|---|---|
instance | Instance | What type of instance to start for the replicas. |
master | Login | Username and password for the administrative user. |
vpc | IVpc | What subnets to run the DocumentDB instances in. |
backup? | Backup | Backup settings. |
cloud | Retention | The number of days log events are kept in CloudWatch Logs. |
cloud | IRole | The IAM role for the Lambda function associated with the custom resource that sets the retention policy. |
db | string | An optional identifier for the cluster. |
deletion | boolean | Specifies whether this cluster can be deleted. |
engine | string | What version of the database to start. |
export | boolean | Whether the audit logs should be exported to CloudWatch. |
export | boolean | Whether the profiler logs should be exported to CloudWatch. |
instance | string | Base identifier for instances. |
instances? | number | Number of DocDB compute instances. |
kms | IKey | The KMS key for storage encryption. |
parameter | ICluster | The DB parameter group to associate with the instance. |
port? | number | The port the DocumentDB cluster will listen on. |
preferred | string | A weekly time range in which maintenance should preferably execute. |
removal | Removal | The removal policy to apply when the cluster and its instances are removed or replaced during a stack update, or when the stack is deleted. |
security | ISecurity | Security group. |
storage | boolean | Whether to enable storage encryption. |
vpc | Subnet | Where to place the instances within the VPC. |
instanceType
Type:
Instance
What type of instance to start for the replicas.
masterUser
Type:
Login
Username and password for the administrative user.
vpc
Type:
IVpc
What subnets to run the DocumentDB instances in.
Must be at least 2 subnets in two different AZs.
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.
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.
dbClusterName?
Type:
string
(optional, default: A name is automatically generated.)
An optional identifier for the cluster.
deletionProtection?
Type:
boolean
(optional, default: false)
Specifies whether this cluster can be deleted.
If deletionProtection is enabled, the cluster cannot be deleted unless it is modified and deletionProtection is disabled. deletionProtection protects clusters from being accidentally deleted.
engineVersion?
Type:
string
(optional, default: The default engine version.)
What version of the database to start.
exportAuditLogsToCloudWatch?
Type:
boolean
(optional, default: false)
Whether the audit logs should be exported to CloudWatch.
Note that you also have to configure the audit log export in the Cluster's Parameter Group.
exportProfilerLogsToCloudWatch?
Type:
boolean
(optional, default: false)
Whether the profiler logs should be exported to CloudWatch.
Note that you also have to configure the profiler log export in the Cluster's Parameter Group.
instanceIdentifierBase?
Type:
string
(optional, default: dbClusterName
is used with the word "Instance" appended. If dbClusterName
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: 1)
Number of DocDB compute instances.
kmsKey?
Type:
IKey
(optional, default: default master key.)
The KMS key for storage encryption.
parameterGroup?
Type:
ICluster
(optional, default: no parameter group)
The DB parameter group to associate with the instance.
port?
Type:
number
(optional, default: DatabaseCluster.DEFAULT_PORT)
The port the DocumentDB cluster will 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 weekly time range in which maintenance should preferably execute.
Must be at least 30 minutes long.
Example: 'tue:04:17-tue:04:47'
removalPolicy?
Type:
Removal
(optional, default: Retain cluster.)
The removal policy to apply when the cluster and its instances are removed or replaced during a stack update, or when the stack is deleted.
This removal policy also applies to the implicit security group created for the cluster if one is not supplied as a parameter.
securityGroup?
Type:
ISecurity
(optional, default: a new security group is created.)
Security group.
storageEncrypted?
Type:
boolean
(optional, default: true)
Whether to enable storage encryption.
vpcSubnets?
Type:
Subnet
(optional, default: private subnets)
Where to place the instances within the VPC.