ec2: allow adding subnet groups/AZs after initial VPC deployment #28644
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p1
Describe the feature
With our current
Vpc
construct, it's easy to get going. What's not obvious however is that once you deploy any machines into your VPC, it becomes impossible to change the layout, not even additively.The reason for that is that because of the way default CIDR allocations are done, whenever any groups or AZs are added, the CIDRs are changed. However, changing a CIDR requires replacing the subnet, and that is not possible as long as any machines are attached to the Subnet. This means that changing the Vpc layout is a very disruptive operation that requires tearing down all infrastructure.
There are two decisions that cause the current behavior:
These problems are prominent in IPv4, where the available IP space is (comparatively) small and must be used efficiently. That's not to say they couldn't be lifted for IPv4 as well, but that's where the motivation for the current design comes from.
In IPv6-land though, IP space is effectively infinite, and we can do whatever.
Use Case
Schematically, this diagram shows the current problem and the proposed solution. The solution can be implemented both for IPv4 and IPv6, but should definitely be considered once IPv6-only VPCs become a thing.
In this use case, a customer has a VPC with 3 Subnet Groups spanning 3 AZs (
a, b, c
) and they want to add a 4th AZ (d
). The same problem would occur in a slightly different shape when a new subnet group would be added instead. You can see the sizes of all subnets shifting when the change is made, necessitating a replacement that will be impossible in practice:Proposed Solution
The proposed solution is:
/64
by default), for IPv4 this is not true. A reasonable default size of IPv4 would probably be/21
, allowing 2046 machines per subnet, but I will leave someone with more experience of real life workloads to opine on this (*).Of course, all of these sizes should be configurable.
Other Information
No response
Acknowledgements
CDK version used
Environment details (OS name and version, etc.)
The text was updated successfully, but these errors were encountered: