(ec2): Support regional NAT gateways in Vpc construct
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Add support for regional NAT gateways to the VPC construct
https://aws.amazon.com/blogs/networking-and-content-delivery/introducing-amazon-vpc-regional-nat-gateway/
https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-natgateway.html
### Use Case
Simpler setup than zonal gateways
### Proposed Solution
maybe simple a `natGatewayType` property for the VPC construct?
### Other Information
You can workaround it for now by doing this
```typescript
const vpc = new ec2.Vpc(this, 'Vpc', {
vpcName: 'foobar',
maxAzs: 3,
natGateways: 1, // Using regional so we only need one
],
});
this.vpc = vpc;
// FIXME: undo this once it is supported by CDK
vpc.node.findAll().forEach((child) => {
if (child instanceof ec2.CfnNatGateway) {
child.addPropertyOverride('AvailabilityMode', 'regional');
child.addPropertyOverride('VpcId', vpc.vpcId);
child.addPropertyDeletionOverride('SubnetId');
}
});
```
### Acknowledgements
- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### AWS CDK Library version (aws-cdk-lib)
aws-cdk-lib@2.227.0
### AWS CDK CLI version
2.1033.0 (build 1ec3310)
### Environment details (OS name and version, etc.)
Ubuntu 25.04
Contributor guide
Research direction
Start at the TypeScript ec2.Vpc construct and its NAT gateway handling. Read the linked regional NAT gateway and CloudFormation NATGateway documentation, then compare the existing workaround with the construct's synthesized resource. Done means a VPC can request regional NAT gateways through the proposed configuration and synthesis produces the corresponding regional resource without the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100