Reputation: 333
I am using cloud formation to create instances, I am using following CIDR configurations for VPC and subnets.
VPC CIDR: "10.15.0.0/16"
Subnet A CIDR: "10.15.10.0/24"
Subnet B CIDR: "10.15.20.0/24"
PrivateSubnet CIDR A: "10.15.90.0/21"
PrivateSubnet CIDR B: "10.15.110.0/21"
I am getting following error. Please let me know what I am doing wrong here ?
The CIDR '10.15.20.0/24' is invalid. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidSubnet.Range; )
Upvotes: 1
Views: 6730
Reputation: 269320
10.15.20.0/24
is fine.
However, 10.15.90.0/21
and 10.15.110.0/21
are invalid.
10.15.90.0/21
falls within 10.15.88.0
to 10.15.95.255
, so it should really be 10.15.88.0/21
10.15.110.0/21
falls within 10.15.104.0
to 10.15.111.255
, so it should really be 10.15.104.0/21
CIDR notation hurts the head, so you always use a CIDR Calculator.
If you don't follow the above concepts, read Classless Inter-Domain Routing - Wikipedia.
Upvotes: 5