Open ChrisLane opened 1 year ago
related to https://github.com/aws/aws-cdk/issues/25537
I expected that the order that I define the subnets would not matter and that they would be placed in an order that works but this is not the case.
Changing the subnet order allows me to synth the configuration:
const ec2 = require("aws-cdk-lib/aws-ec2");
const vpc = new ec2.Vpc(this, "my-vpc", {
vpcName: "my-vpc",
ipAddresses: ec2.IpAddresses.cidr("10.199.32.0/20"),
natGateways: 1,
subnetConfiguration: [
{
name: `private-with-nat-subnet`,
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
cidrMask: 22
},
{
name: "public-subnet",
subnetType: ec2.SubnetType.PUBLIC,
cidrMask: 25
},
{
name: `private-isolated-subnet`,
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
cidrMask: 25
}
]
});
Yes your issue still relevant and workaround works for me.
Describe the bug
I cannot synth the following code:
Instead, I get the error
1 of /25 exceeds remaining space of 10.199.32.0/20
.Expected Behavior
I understand that the default config results in 3 AZs, meaning this configuration would have a total of 9 subnets.
As far as I'm aware, the above configuration should be able to produce a subnet layout similar to the following that fits within the given CIDR:
Current Behavior
Instead of the synth succeeding, I get the error
1 of /25 exceeds remaining space of 10.199.32.0/20
.Reproduction Steps
Attempt to synth the example code.
Possible Solution
Perhaps there is a hidden network feature that is restricting the IP space available to me, otherwise I think I've miscalculated my subnets or this is a bug.
Additional Information/Context
No response
CDK CLI Version
2.81.0
Framework Version
No response
Node.js Version
20.2.0
OS
Arch Linux 6.3.4
Language
Typescript
Language Version
JavaScript
Other information
If I reduce the
PRIVATE_WITH_EGRESS
CIDR mask to /23, I can successfully synth the project but this provides me with considerably fewer IPs.