Skip to content

(rds): allow to specify availability zone for Aurora instances #33503

@Tietew

Description

@Tietew

Describe the feature

We can specify AvailabilityZone in Aurora's AWS::RDS::DBInstance as same as standalone RDS instances.
CDK is missing the feature.

Use Case

When I create a single-zone Aurora cluster and an EC2 instance in development purpose, I want to pin the Aurora instance and the EC2 instance in a same availability zone.

For example:

const instance = new ec2.Instance(this, 'MyDevelopmentInstance', {
  availabilityZone: 'ap-northeast-1a',
  // ...
});
const cluster = new rds.DatabaseCluster(this, 'MyDevelopmentCluster', {
  writer: rds.ClusterInstance.serverlessV2('SingleInstance', {
    availabilityZone: 'ap-northeast-1a', // THIS
  },
  // ...
});

Proposed Solution

Add availaiblityZone prop to ClusterInstanceOptions.

Other Information

Escape hatch available but a bit complex.

const cfnInstance = cluster.node.findChild('SingleInstance').node.defaultChild as rds.CfnDBInstance;
cfnInstance.availabilityZone = 'ap-northeast-1a';

I confirmed above escape hatch worked.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.179.0

Environment details (OS name and version, etc.)

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-rdsRelated to Amazon Relational Databaseeffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions