Skip to content

(ec2): Support regional NAT gateways in Vpc construct #36198

@johnf

Description

@johnf

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

    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

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

AWS CDK Library version (aws-cdk-lib)

[email protected]

AWS CDK CLI version

2.1033.0 (build 1ec3310)

Environment details (OS name and version, etc.)

Ubuntu 25.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ec2Related to Amazon Elastic Compute Cloudeffort/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