interface DatabaseClusterProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.DocDB.DatabaseClusterProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsdocdb#DatabaseClusterProps |
Java | software.amazon.awscdk.services.docdb.DatabaseClusterProps |
Python | aws_cdk.aws_docdb.DatabaseClusterProps |
TypeScript (source) | aws-cdk-lib » 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',
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE),
vpcSubnets: {
subnetType: ec2.SubnetType.PUBLIC,
},
vpc,
removalPolicy: RemovalPolicy.SNAPSHOT,
});
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. |
ca | Ca | The identifier of the CA certificate used for the instances. |
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. |
copy | boolean | Whether to copy tags to the snapshot when a snapshot is created. |
db | string | An optional identifier for the cluster. |
deletion | boolean | Specifies whether this cluster can be deleted. |
enable | boolean | A value that indicates whether to enable Performance Insights for the instances in the DB Cluster. |
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. |
instance | Removal | The removal policy to apply to the cluster's 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. |
security | Removal | The removal policy to apply to the cluster's security group. |
storage | boolean | Whether to enable storage encryption. |
storage | Storage | The storage type of the DocDB cluster. |
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.
caCertificate?
Type:
Ca
(optional, default: DocumentDB will choose a certificate authority)
The identifier of the CA certificate used for the instances.
Specifying or updating this property triggers a reboot.
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.
copyTagsToSnapshot?
Type:
boolean
(optional, default: false)
Whether to copy tags to the snapshot when a snapshot is created.
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.
enablePerformanceInsights?
Type:
boolean
(optional, default: false)
A value that indicates whether to enable Performance Insights for the instances in the DB Cluster.
engineVersion?
Type:
string
(optional, default: the latest major 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.
instanceRemovalPolicy?
Type:
Removal
(optional, default: RemovalPolicy.DESTROY
when removalPolicy
is set to SNAPSHOT
, removalPolicy
otherwise.)
The removal policy to apply to the cluster's instances.
Cannot be set to SNAPSHOT
.
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.
When set to SNAPSHOT
, the removal policy for the instances and the security group
will default to DESTROY
as those resources do not support the policy.
Use the instanceRemovalPolicy
and securityGroupRemovalPolicy
to change the behavior.
securityGroup?
Type:
ISecurity
(optional, default: a new security group is created.)
Security group.
securityGroupRemovalPolicy?
Type:
Removal
(optional, default: RemovalPolicy.DESTROY
when removalPolicy
is set to SNAPSHOT
, removalPolicy
otherwise.)
The removal policy to apply to the cluster's security group.
Cannot be set to SNAPSHOT
.
storageEncrypted?
Type:
boolean
(optional, default: true)
Whether to enable storage encryption.
storageType?
Type:
Storage
(optional, default: StorageType.STANDARD)
The storage type of the DocDB cluster.
I/O-optimized storage is supported starting with engine version 5.0.0.
vpcSubnets?
Type:
Subnet
(optional, default: private subnets)
Where to place the instances within the VPC.