class ClusterInstance
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.RDS.ClusterInstance |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsrds#ClusterInstance |
Java | software.amazon.awscdk.services.rds.ClusterInstance |
Python | aws_cdk.aws_rds.ClusterInstance |
TypeScript (source) | aws-cdk-lib » aws_rds » ClusterInstance |
Implements
ICluster
Create an RDS Aurora Cluster Instance.
You can create either provisioned or serverless v2 instances.
Example
declare const vpc: ec2.Vpc;
const myCluster = new rds.DatabaseCluster(this, 'Database', {
engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }),
writer: rds.ClusterInstance.provisioned('writer', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.XLARGE4),
}),
serverlessV2MinCapacity: 6.5,
serverlessV2MaxCapacity: 64,
readers: [
// will be put in promotion tier 1 and will scale with the writer
rds.ClusterInstance.serverlessV2('reader1', { scaleWithWriter: true }),
// will be put in promotion tier 2 and will not scale with the writer
rds.ClusterInstance.serverlessV2('reader2'),
],
vpc,
});
Methods
Name | Description |
---|---|
bind(scope, cluster, props) | Add the ClusterInstance to the cluster. |
static provisioned(id, props?) | Add a provisioned instance to the cluster. |
static serverless | Add a serverless v2 instance to the cluster. |
bind(scope, cluster, props)
public bind(scope: Construct, cluster: IDatabaseCluster, props: ClusterInstanceBindOptions): IAuroraClusterInstance
Parameters
- scope
Construct
- cluster
IDatabase
Cluster - props
Cluster
Instance Bind Options
Returns
Add the ClusterInstance to the cluster.
static provisioned(id, props?)
public static provisioned(id: string, props?: ProvisionedClusterInstanceProps): IClusterInstance
Parameters
- id
string
- props
Provisioned
Cluster Instance Props
Returns
Add a provisioned instance to the cluster. Example
rds.ClusterInstance.provisioned('ClusterInstance', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.XLARGE4),
});
static serverlessV2(id, props?)
public static serverlessV2(id: string, props?: ServerlessV2ClusterInstanceProps): IClusterInstance
Parameters
- id
string
- props
Serverless
V2 Cluster Instance Props
Returns
Add a serverless v2 instance to the cluster. Example
rds.ClusterInstance.serverlessV2('ClusterInstance', {
scaleWithWriter: true,
});