Class DatabaseClusterProps
Properties for a new database cluster.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.DocDB
Assembly: Amazon.CDK.AWS.DocDB.dll
Syntax (csharp)
public class DatabaseClusterProps : Object, IDatabaseClusterProps
Syntax (vb)
Public Class DatabaseClusterProps
Inherits Object
Implements IDatabaseClusterProps
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
var cluster = new DatabaseCluster(this, "Database", new DatabaseClusterProps {
MasterUser = new Login {
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"
},
InstanceType = InstanceType.Of(InstanceClass.R5, InstanceSize.LARGE),
VpcSubnets = new SubnetSelection {
SubnetType = SubnetType.PUBLIC
},
Vpc = vpc
});
Synopsis
Constructors
DatabaseClusterProps() |
Properties
Backup | Backup settings. |
CloudWatchLogsRetention | The number of days log events are kept in CloudWatch Logs. |
CloudWatchLogsRetentionRole | The IAM role for the Lambda function associated with the custom resource that sets the retention policy. |
DbClusterName | An optional identifier for the cluster. |
DeletionProtection | Specifies whether this cluster can be deleted. |
EngineVersion | What version of the database to start. |
ExportAuditLogsToCloudWatch | Whether the audit logs should be exported to CloudWatch. |
ExportProfilerLogsToCloudWatch | Whether the profiler logs should be exported to CloudWatch. |
InstanceIdentifierBase | Base identifier for instances. |
Instances | Number of DocDB compute instances. |
InstanceType | What type of instance to start for the replicas. |
KmsKey | The KMS key for storage encryption. |
MasterUser | Username and password for the administrative user. |
ParameterGroup | The DB parameter group to associate with the instance. |
Port | The port the DocumentDB cluster will listen on. |
PreferredMaintenanceWindow | A weekly time range in which maintenance should preferably execute. |
RemovalPolicy | 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. |
SecurityGroup | Security group. |
StorageEncrypted | Whether to enable storage encryption. |
Vpc | What subnets to run the DocumentDB instances in. |
VpcSubnets | Where to place the instances within the VPC. |
Constructors
DatabaseClusterProps()
public DatabaseClusterProps()
Properties
Backup
Backup settings.
public IBackupProps Backup { get; set; }
Property Value
Remarks
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.
CloudWatchLogsRetention
The number of days log events are kept in CloudWatch Logs.
public Nullable<RetentionDays> CloudWatchLogsRetention { get; set; }
Property Value
System.Nullable<RetentionDays>
Remarks
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
CloudWatchLogsRetentionRole
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
public IRole CloudWatchLogsRetentionRole { get; set; }
Property Value
Remarks
Default: - a new role is created.
DbClusterName
An optional identifier for the cluster.
public string DbClusterName { get; set; }
Property Value
System.String
Remarks
Default: - A name is automatically generated.
DeletionProtection
Specifies whether this cluster can be deleted.
public Nullable<bool> DeletionProtection { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
If deletionProtection is enabled, the cluster cannot be deleted unless it is modified and deletionProtection is disabled. deletionProtection protects clusters from being accidentally deleted.
Default: - false
EngineVersion
What version of the database to start.
public string EngineVersion { get; set; }
Property Value
System.String
Remarks
Default: - The default engine version.
ExportAuditLogsToCloudWatch
Whether the audit logs should be exported to CloudWatch.
public Nullable<bool> ExportAuditLogsToCloudWatch { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Note that you also have to configure the audit log export in the Cluster's Parameter Group.
Default: false
ExportProfilerLogsToCloudWatch
Whether the profiler logs should be exported to CloudWatch.
public Nullable<bool> ExportProfilerLogsToCloudWatch { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Note that you also have to configure the profiler log export in the Cluster's Parameter Group.
Default: false
InstanceIdentifierBase
Base identifier for instances.
public string InstanceIdentifierBase { get; set; }
Property Value
System.String
Remarks
Every replica is named by appending the replica number to this string, 1-based.
Default: - dbClusterName
is used with the word "Instance" appended. If dbClusterName
is not provided, the
identifier is automatically generated.
Instances
Number of DocDB compute instances.
public Nullable<double> Instances { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: 1
InstanceType
What type of instance to start for the replicas.
public InstanceType InstanceType { get; set; }
Property Value
KmsKey
The KMS key for storage encryption.
public IKey KmsKey { get; set; }
Property Value
Remarks
Default: - default master key.
MasterUser
Username and password for the administrative user.
public ILogin MasterUser { get; set; }
Property Value
ParameterGroup
The DB parameter group to associate with the instance.
public IClusterParameterGroup ParameterGroup { get; set; }
Property Value
Remarks
Default: no parameter group
Port
The port the DocumentDB cluster will listen on.
public Nullable<double> Port { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: DatabaseCluster.DEFAULT_PORT
PreferredMaintenanceWindow
A weekly time range in which maintenance should preferably execute.
public string PreferredMaintenanceWindow { get; set; }
Property Value
System.String
Remarks
Must be at least 30 minutes long.
Example: 'tue:04:17-tue:04:47'
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.
RemovalPolicy
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.
public Nullable<RemovalPolicy> RemovalPolicy { get; set; }
Property Value
System.Nullable<RemovalPolicy>
Remarks
This removal policy also applies to the implicit security group created for the cluster if one is not supplied as a parameter.
Default: - Retain cluster.
SecurityGroup
Security group.
public ISecurityGroup SecurityGroup { get; set; }
Property Value
Remarks
Default: a new security group is created.
StorageEncrypted
Whether to enable storage encryption.
public Nullable<bool> StorageEncrypted { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
Vpc
What subnets to run the DocumentDB instances in.
public IVpc Vpc { get; set; }
Property Value
Remarks
Must be at least 2 subnets in two different AZs.
VpcSubnets
Where to place the instances within the VPC.
public ISubnetSelection VpcSubnets { get; set; }
Property Value
Remarks
Default: private subnets