Skip to content

aws-ec2: New SubnetType enum for subnets attached to a TGW #21189

@adrianmace

Description

@adrianmace

Describe the feature

Create a new SubnetType enum that is used to identify a Private subnet with a Transit Gateway Attachment. This should work in an identical way to PRIVATE_WITH_NAT.

Use Case

When importing existing VPCs to CDK using fromLookup, subnets which have no NAT Gateway are all considered PRIVATE_ISOLATED, even though some of these subnets do have an attached Transit Gateway and appropriate routes.

Proposed Solution

  • Create enum SubnetType PRIVATE_WITH_TGW.
  • Update fromLookup function as necessary to ensure subnets are correctly identified.

Other Information

In order to enable ZDT switching between NGW and TGW in the same VPC, we configure the routes to the TGW as 0.0.0.0/1 and 128.0.0.0/1. While it would be unreasonable to recursively search all of the IPv4 address space, I think the existence of these two routes pointing to the same location should be equivalent to a default route (0.0.0.0/0) check.

Acknowledgements

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

CDK version used

2.32.1

Environment details (OS name and version, etc.)

macOS 12.4

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