Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 2 tasks
Tietew opened this issue Feb 19, 2025 · 3 comments · Fixed by #33515
Closed
1 of 2 tasks

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

Tietew opened this issue Feb 19, 2025 · 3 comments · Fixed by #33515
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@Tietew
Copy link
Contributor

Tietew commented Feb 19, 2025

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

@Tietew Tietew added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2025
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label Feb 19, 2025
@pahud
Copy link
Contributor

pahud commented Feb 19, 2025

Yeah if cloudformation supports that, we should allow CDK users to specify that as well.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2025
@mergify mergify bot closed this as completed in #33515 Mar 12, 2025
@mergify mergify bot closed this as completed in 583d5f2 Mar 12, 2025
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2025
hwum pushed a commit to hwum/aws-cdk that referenced this issue Mar 12, 2025
…ws#33515)

### Issue # (if applicable)

Closes aws#33503.
Closes aws#30618.

### Reason for this change

When creating 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.
We can specify `AvailabilityZone` in Aurora's `AWS::RDS::DBInstance` as same as standalone RDS instances.

### Description of changes

Added `availabilityZone` prop in `ClusterInstanceOptions`

### Describe any new or updated permissions being added

N/A

### Description of how you validated changes

Unit test and integ test.
The integ test also verifies created instances are placed in expected availability zone.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants