interface ClusterInstanceProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.RDS.ClusterInstanceProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsrds#ClusterInstanceProps |
Java | software.amazon.awscdk.services.rds.ClusterInstanceProps |
Python | aws_cdk.aws_rds.ClusterInstanceProps |
TypeScript (source) | aws-cdk-lib » aws_rds » ClusterInstanceProps |
Common options for creating cluster instances (both serverless and provisioned).
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_rds as rds } from 'aws-cdk-lib';
declare const caCertificate: rds.CaCertificate;
declare const clusterInstanceType: rds.ClusterInstanceType;
declare const key: kms.Key;
declare const parameterGroup: rds.ParameterGroup;
const clusterInstanceProps: rds.ClusterInstanceProps = {
instanceType: clusterInstanceType,
// the properties below are optional
allowMajorVersionUpgrade: false,
autoMinorVersionUpgrade: false,
caCertificate: caCertificate,
enablePerformanceInsights: false,
instanceIdentifier: 'instanceIdentifier',
isFromLegacyInstanceProps: false,
parameterGroup: parameterGroup,
parameters: {
parametersKey: 'parameters',
},
performanceInsightEncryptionKey: key,
performanceInsightRetention: rds.PerformanceInsightRetention.DEFAULT,
preferredMaintenanceWindow: 'preferredMaintenanceWindow',
promotionTier: 123,
publiclyAccessible: false,
};
Properties
Name | Type | Description |
---|---|---|
instance | Cluster | The type of cluster instance to create. |
allow | boolean | Whether to allow upgrade of major version for the DB instance. |
auto | boolean | Whether to enable automatic upgrade of minor version for the DB instance. |
ca | Ca | The identifier of the CA certificate for this DB cluster's instances. |
enable | boolean | Whether to enable Performance Insights for the DB instance. |
instance | string | The identifier for the database instance. |
is | boolean | Only used for migrating existing clusters from using instanceProps to writer and readers . |
parameter | IParameter | The DB parameter group to associate with the instance. |
parameters? | { [string]: string } | The parameters in the DBParameterGroup to create automatically. |
performance | IKey | The AWS KMS key for encryption of Performance Insights data. |
performance | Performance | The amount of time, in days, to retain Performance Insights data. |
preferred | string | A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). |
promotion | number | The promotion tier of the cluster instance. |
publicly | boolean | Indicates whether the DB instance is an internet-facing instance. |
instanceType
Type:
Cluster
The type of cluster instance to create.
Can be either provisioned or serverless v2
allowMajorVersionUpgrade?
Type:
boolean
(optional, default: false)
Whether to allow upgrade of major version for the DB instance.
autoMinorVersionUpgrade?
Type:
boolean
(optional, default: true)
Whether to enable automatic upgrade of minor version for the DB instance.
caCertificate?
Type:
Ca
(optional, default: RDS will choose a certificate authority)
The identifier of the CA certificate for this DB cluster's instances.
Specifying or updating this property triggers a reboot.
For RDS DB engines:
enablePerformanceInsights?
Type:
boolean
(optional, default: false, unless performanceInsightRetention
or performanceInsightEncryptionKey
is set.)
Whether to enable Performance Insights for the DB instance.
instanceIdentifier?
Type:
string
(optional, default: CloudFormation generated identifier)
The identifier for the database instance.
isFromLegacyInstanceProps?
Type:
boolean
(optional, default: false)
Only used for migrating existing clusters from using instanceProps
to writer
and readers
.
Example
// existing cluster
declare const vpc: ec2.Vpc;
const cluster = new rds.DatabaseCluster(this, 'Database', {
engine: rds.DatabaseClusterEngine.auroraMysql({
version: rds.AuroraMysqlEngineVersion.VER_3_03_0,
}),
instances: 2,
instanceProps: {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL),
vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
vpc,
},
});
// migration
const instanceProps = {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL),
isFromLegacyInstanceProps: true,
};
const myCluster = new rds.DatabaseCluster(this, 'Database', {
engine: rds.DatabaseClusterEngine.auroraMysql({
version: rds.AuroraMysqlEngineVersion.VER_3_03_0,
}),
vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
vpc,
writer: rds.ClusterInstance.provisioned('Instance1', {
instanceType: instanceProps.instanceType,
isFromLegacyInstanceProps: instanceProps.isFromLegacyInstanceProps,
}),
readers: [
rds.ClusterInstance.provisioned('Instance2', {
instanceType: instanceProps.instanceType,
isFromLegacyInstanceProps: instanceProps.isFromLegacyInstanceProps,
}),
],
});
parameterGroup?
Type:
IParameter
(optional, default: the cluster parameter group is used)
The DB parameter group to associate with the instance.
This is only needed if you need to configure different parameter groups for each individual instance, otherwise you should not provide this and just use the cluster parameter group
parameters?
Type:
{ [string]: string }
(optional, default: None)
The parameters in the DBParameterGroup to create automatically.
You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBParameterGroup.
performanceInsightEncryptionKey?
Type:
IKey
(optional, default: default master key)
The AWS KMS key for encryption of Performance Insights data.
performanceInsightRetention?
Type:
Performance
(optional, default: 7)
The amount of time, in days, to retain Performance Insights data.
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 preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).
Example: 'Sun:23:45-Mon:00:15'
promotionTier?
Type:
number
(optional, default: 2)
The promotion tier of the cluster instance.
This matters more for serverlessV2 instances. If a serverless instance is in tier 0-1 then it will scale with the writer.
For provisioned instances this just determines the failover priority. If multiple instances have the same priority then one will be picked at random
publiclyAccessible?
Type:
boolean
(optional, default: true
if the cluster's vpcSubnets
is subnetType: SubnetType.PUBLIC
, false
otherwise)
Indicates whether the DB instance is an internet-facing instance.
If not specified, the cluster's vpcSubnets will be used to determine if the instance is internet-facing or not.