I am using CDK with C# to create a VPC and subnets in us-east-1.
var newVpc = new Vpc(this, "myVPC", new VpcProps
{
MaxAzs = 3,
IpAddresses = IpAddresses.Cidr("192.168.1.0/16"),
EnableDnsHostnames = true,
EnableDnsSupport = true,
});
Here are the two private subnets I am attempting to create.
var pvtSub1 = new Subnet(this, "pvt-sub1", new SubnetProps
{
VpcId = myVpc.VpcId,
AvailabilityZone = "us-east-1a",
CidrBlock = "192.168.1.0/28",
MapPublicIpOnLaunch =false
});
var pvtSub2 = new Subnet(this, "pvt-sub2", new SubnetProps
{
VpcId = myVpc.VpcId,
AvailabilityZone = "us-east-1b",
CidrBlock = "192.168.1.16/28",
MapPublicIpOnLaunch = false
});
These are failing with error message:
Resource handler returned message: "The CIDR '192.168.1.0/28' is invalid
Resource handler returned message: "The CIDR '192.168.1.16/28' is invalid
Why would these be invalid? When I checked here the subnets 0 and 1 seem to be reflecting my specifications in CDK. So, what am I missing?