Class DatabaseClusterProps
Properties for a new database cluster.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.RDS
Assembly: Amazon.CDK.AWS.RDS.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 {
Engine = DatabaseClusterEngine.AURORA,
InstanceProps = new InstanceProps { Vpc = vpc }
});
var proxy = new DatabaseProxy(this, "Proxy", new DatabaseProxyProps {
ProxyTarget = ProxyTarget.FromCluster(cluster),
Secrets = new [] { cluster.Secret },
Vpc = vpc
});
var role = new Role(this, "DBProxyRole", new RoleProps { AssumedBy = new AccountPrincipal(Account) });
proxy.GrantConnect(role, "admin");
Synopsis
Constructors
DatabaseClusterProps() |
Properties
BacktrackWindow | The number of seconds to set a cluster's target backtrack window to. |
Backup | Backup settings. |
CloudwatchLogsExports | The list of log types that need to be enabled for exporting to CloudWatch Logs. |
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. |
ClusterIdentifier | An optional identifier for the cluster. |
CopyTagsToSnapshot | Whether to copy tags to the snapshot when a snapshot is created. |
Credentials | Credentials for the administrative user. |
DefaultDatabaseName | Name of a database which is automatically created inside the cluster. |
DeletionProtection | Indicates whether the DB cluster should have deletion protection enabled. |
Engine | What kind of database to start. |
IamAuthentication | Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. |
InstanceIdentifierBase | Base identifier for instances. |
InstanceProps | Settings for the individual instances that are launched. |
Instances | How many replicas/instances to create. |
MonitoringInterval | The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances. |
MonitoringRole | Role that will be used to manage DB instances monitoring. |
ParameterGroup | Additional parameters to pass to the database engine. |
Parameters | The parameters in the DBClusterParameterGroup to create automatically. |
Port | What port to listen on. |
PreferredMaintenanceWindow | A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). |
RemovalPolicy | The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update. |
S3ExportBuckets | S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine. |
S3ExportRole | Role that will be associated with this DB cluster to enable S3 export. |
S3ImportBuckets | S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine. |
S3ImportRole | Role that will be associated with this DB cluster to enable S3 import. |
StorageEncrypted | Whether to enable storage encryption. |
StorageEncryptionKey | The KMS key for storage encryption. |
SubnetGroup | Existing subnet group for the cluster. |
Constructors
DatabaseClusterProps()
public DatabaseClusterProps()
Properties
BacktrackWindow
The number of seconds to set a cluster's target backtrack window to.
public Duration BacktrackWindow { get; set; }
Property Value
Remarks
This feature is only supported by the Aurora MySQL database engine and cannot be enabled on existing clusters.
Default: 0 seconds (no backtrack)
See: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html
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.
CloudwatchLogsExports
The list of log types that need to be enabled for exporting to CloudWatch Logs.
public string[] CloudwatchLogsExports { get; set; }
Property Value
System.String[]
Remarks
Default: - no log exports
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.
ClusterIdentifier
An optional identifier for the cluster.
public string ClusterIdentifier { get; set; }
Property Value
System.String
Remarks
Default: - A name is automatically generated.
CopyTagsToSnapshot
Whether to copy tags to the snapshot when a snapshot is created.
public Nullable<bool> CopyTagsToSnapshot { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - true
Credentials
Credentials for the administrative user.
public Credentials Credentials { get; set; }
Property Value
Remarks
Default: - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password
DefaultDatabaseName
Name of a database which is automatically created inside the cluster.
public string DefaultDatabaseName { get; set; }
Property Value
System.String
Remarks
Default: - Database is not created in cluster.
DeletionProtection
Indicates whether the DB cluster should have deletion protection enabled.
public Nullable<bool> DeletionProtection { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - true if removalPolicy
is RETAIN, false otherwise
Engine
What kind of database to start.
public IClusterEngine Engine { get; set; }
Property Value
IamAuthentication
Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.
public Nullable<bool> IamAuthentication { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
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: - clusterIdentifier is used with the word "Instance" appended. If clusterIdentifier is not provided, the identifier is automatically generated.
InstanceProps
Settings for the individual instances that are launched.
public IInstanceProps InstanceProps { get; set; }
Property Value
Instances
How many replicas/instances to create.
public Nullable<double> Instances { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Has to be at least 1.
Default: 2
MonitoringInterval
The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances.
public Duration MonitoringInterval { get; set; }
Property Value
Remarks
Default: no enhanced monitoring
MonitoringRole
Role that will be used to manage DB instances monitoring.
public IRole MonitoringRole { get; set; }
Property Value
Remarks
Default: - A role is automatically created for you
ParameterGroup
Additional parameters to pass to the database engine.
public IParameterGroup ParameterGroup { get; set; }
Property Value
Remarks
Default: - No parameter group.
Parameters
The parameters in the DBClusterParameterGroup to create automatically.
public IDictionary<string, string> Parameters { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBClusterParameterGroup.
Default: - None
Port
What port to listen on.
public Nullable<double> Port { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - The default for the engine is used.
PreferredMaintenanceWindow
A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).
public string PreferredMaintenanceWindow { get; set; }
Property Value
System.String
Remarks
Example: 'Sun:23:45-Mon:00:15'
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 from the stack or replaced during an update.
public Nullable<RemovalPolicy> RemovalPolicy { get; set; }
Property Value
System.Nullable<RemovalPolicy>
Remarks
Default: - RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data)
S3ExportBuckets
S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine.
public IBucket[] S3ExportBuckets { get; set; }
Property Value
IBucket[]
Remarks
This property must not be used if s3ExportRole
is used.
For MySQL:
Default: - None
See: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html
S3ExportRole
Role that will be associated with this DB cluster to enable S3 export.
public IRole S3ExportRole { get; set; }
Property Value
Remarks
This feature is only supported by the Aurora database engine.
This property must not be used if s3ExportBuckets
is used.
For MySQL:
Default: - New role is created if s3ExportBuckets
is set, no role is defined otherwise
See: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html
S3ImportBuckets
S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine.
public IBucket[] S3ImportBuckets { get; set; }
Property Value
IBucket[]
Remarks
This property must not be used if s3ImportRole
is used.
For MySQL:
Default: - None
See: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html
S3ImportRole
Role that will be associated with this DB cluster to enable S3 import.
public IRole S3ImportRole { get; set; }
Property Value
Remarks
This feature is only supported by the Aurora database engine.
This property must not be used if s3ImportBuckets
is used.
For MySQL:
Default: - New role is created if s3ImportBuckets
is set, no role is defined otherwise
See: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html
StorageEncrypted
Whether to enable storage encryption.
public Nullable<bool> StorageEncrypted { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - true if storageEncryptionKey is provided, false otherwise
StorageEncryptionKey
The KMS key for storage encryption.
public IKey StorageEncryptionKey { get; set; }
Property Value
Remarks
If specified, {@link storageEncrypted} will be set to true
.
Default: - if storageEncrypted is true then the default master key, no key otherwise
SubnetGroup
Existing subnet group for the cluster.
public ISubnetGroup SubnetGroup { get; set; }
Property Value
Remarks
Default: - a new subnet group will be created.