DatabaseClusterProps Struct
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,
deletionProtection: true, // Enable deletion protection.
});
Properties
backupBackupPropsbackupBackupPropsbackupBackupPropsBackupBackupPropsBackupBackupProps= Backup retention period for auto…#default
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.
caCertificateCaCertificateca_certificateCaCertificatecaCertificateCaCertificateCaCertificateCaCertificateCaCertificateCaCertificate= DocumentDB will choose a certifi…#Specifying or updating this property triggers a reboot.
default
Default: DocumentDB will choose a certificate authority
cloudWatchLogsRetentionRetentionDayscloud_watch_logs_retentionRetentionDayscloudWatchLogsRetentionRetentionDaysCloudWatchLogsRetentionRetentionDaysCloudWatchLogsRetentionRetentionDays= logs never expire#When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to Infinity.
cloudWatchLogsRetentionRoleIRolecloud_watch_logs_retention_roleIRolecloudWatchLogsRetentionRoleIRoleCloudWatchLogsRetentionRoleIRoleCloudWatchLogsRetentionRoleIRole= a new role is created.#copyTagsToSnapshotbooleancopy_tags_to_snapshotboolcopyTagsToSnapshotBooleanCopyTagsToSnapshotboolCopyTagsToSnapshot*bool= false#dbClusterNamestringdb_cluster_namestrdbClusterNameStringDbClusterNamestringDbClusterName*string= A name is automatically generate…#default
Default: A name is automatically generated.
deletionProtectionbooleandeletion_protectionbooldeletionProtectionBooleanDeletionProtectionboolDeletionProtection*bool= false#If deletionProtection is enabled, the cluster cannot be deleted unless it is modified and deletionProtection is disabled. deletionProtection protects clusters from being accidentally deleted.
enablePerformanceInsightsbooleanenable_performance_insightsboolenablePerformanceInsightsBooleanEnablePerformanceInsightsboolEnablePerformanceInsights*bool= false#engineVersionstringengine_versionstrengineVersionStringEngineVersionstringEngineVersion*string= the latest major version#exportAuditLogsToCloudWatchbooleanexport_audit_logs_to_cloud_watchboolexportAuditLogsToCloudWatchBooleanExportAuditLogsToCloudWatchboolExportAuditLogsToCloudWatch*bool= false#Note that you also have to configure the audit log export in the Cluster's Parameter Group.
exportProfilerLogsToCloudWatchbooleanexport_profiler_logs_to_cloud_watchboolexportProfilerLogsToCloudWatchBooleanExportProfilerLogsToCloudWatchboolExportProfilerLogsToCloudWatch*bool= false#Note that you also have to configure the profiler log export in the Cluster's Parameter Group.
instanceIdentifierBasestringinstance_identifier_basestrinstanceIdentifierBaseStringInstanceIdentifierBasestringInstanceIdentifierBase*string= `dbClusterName` is used with the…#Every replica is named by appending the replica number to this string, 1-based. Only applicable for provisioned clusters.
default
Default: dbClusterName is used with the word "Instance" appended. If dbClusterName is not provided, the identifier is automatically generated.
instanceMaintenanceWindowstringinstance_maintenance_windowstrinstanceMaintenanceWindowStringInstanceMaintenanceWindowstringInstanceMaintenanceWindow*string= a 30-minute window selected at r…#notes · default
The cluster-level preferredMaintenanceWindow applies to cluster-wide maintenance events; this prop applies to each auto-created instance independently. To use the same window for both, set this prop to the same value as preferredMaintenanceWindow.
Format: ddd:hh24:mi-ddd:hh24:mi. Must be at least 30 minutes long. Example: 'sat:09:00-sat:09:30'
Only applicable to provisioned clusters; has no effect on serverless clusters because they do not create instances.
Default: 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.
instanceRemovalPolicyRemovalPolicyinstance_removal_policyRemovalPolicyinstanceRemovalPolicyRemovalPolicyInstanceRemovalPolicyRemovalPolicyInstanceRemovalPolicyRemovalPolicy= `RemovalPolicy.DESTROY` when `re…#Cannot be set to SNAPSHOT.
default
Default: RemovalPolicy.DESTROY when removalPolicy is set to SNAPSHOT, removalPolicy otherwise.
instanceTypeInstanceTypeinstance_typeInstanceTypeinstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceType= None#Required for provisioned clusters, not applicable for serverless clusters.
manageMasterUserPasswordbooleanmanage_master_user_passwordboolmanageMasterUserPasswordBooleanManageMasterUserPasswordboolManageMasterUserPassword*bool= false#notes
When set to true, Amazon DocumentDB will automatically generate and manage the master user password in AWS Secrets Manager. This provides enhanced security and automatic password rotation capabilities.
Constraint: You can't manage the master user password with AWS Secrets Manager if masterUser.password is specified.
The secret property of the cluster is not set when using this option. See the module README for how to access the managed secret.
masterUserSecretKmsKeyIKeymaster_user_secret_kms_keyIKeymasterUserSecretKmsKeyIKeyMasterUserSecretKmsKeyIKeyMasterUserSecretKmsKeyIKey= default AWS managed key `aws/sec…#notes · default
This setting is valid only if the master user password is managed by Amazon DocumentDB in AWS Secrets Manager for the DB cluster (i.e. when manageMasterUserPassword is true). If you don't specify this property, then the aws/secretsmanager KMS key is used to encrypt the secret.
Default: default AWS managed key aws/secretsmanager
parameterGroupIDBClusterParameterGroupRefparameter_groupIDBClusterParameterGroupRefparameterGroupIDBClusterParameterGroupRefParameterGroupIDBClusterParameterGroupRefParameterGroupIDBClusterParameterGroupRef= no parameter group#preferredMaintenanceWindowstringpreferred_maintenance_windowstrpreferredMaintenanceWindowStringPreferredMaintenanceWindowstringPreferredMaintenanceWindow*string= 30-minute window selected at ran…#Must be at least 30 minutes long.
Example: 'tue:04:17-tue:04:47'
default
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.
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= Retain cluster.#notes
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.
securityGroupISecurityGroupsecurity_groupISecurityGroupsecurityGroupISecurityGroupSecurityGroupISecurityGroupSecurityGroupISecurityGroup= a new security group is created.#securityGroupRemovalPolicyRemovalPolicysecurity_group_removal_policyRemovalPolicysecurityGroupRemovalPolicyRemovalPolicySecurityGroupRemovalPolicyRemovalPolicySecurityGroupRemovalPolicyRemovalPolicy= `RemovalPolicy.DESTROY` when `re…#Cannot be set to SNAPSHOT.
default
Default: RemovalPolicy.DESTROY when removalPolicy is set to SNAPSHOT, removalPolicy otherwise.
serverlessV2ScalingConfigurationServerlessV2ScalingConfigurationserverless_v2_scaling_configurationServerlessV2ScalingConfigurationserverlessV2ScalingConfigurationServerlessV2ScalingConfigurationServerlessV2ScalingConfigurationServerlessV2ScalingConfigurationServerlessV2ScalingConfigurationServerlessV2ScalingConfiguration= None#When specified, the cluster will be created as a serverless cluster.
storageEncryptedbooleanstorage_encryptedboolstorageEncryptedBooleanStorageEncryptedboolStorageEncrypted*bool= true#storageTypeStorageTypestorage_typeStorageTypestorageTypeStorageTypeStorageTypeStorageTypeStorageTypeStorageType= StorageType.STANDARD#I/O-optimized storage is supported starting with engine version 5.0.0.
Must be at least 2 subnets in two different AZs.
vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection= private subnets#