Error while creating subnet

How to handle “CIDR Address overlaps with existing Subnet CIDR.” error while creating subnet?
For example:-
IPv4 VPC CIDR block :- 172.31.0.0/16

What IPv4 subnet CIDR block should to avoid “CIDR Address overlaps with existing Subnet CIDR” error and how to get to this value .

Hi @Mohit97

With 172.31.0.0/16, you get 65,536 IPs. Which are further divided into subnets. You need to create a new subnet that does not use an IP range that overlaps with the existing subnets. A CIDR calculator could help you.

1 Like

Thanks for your quicl support. I watched some of the videos on youtube and came across the CIDR calculator thing still not very much clear how to create a new subnet that does not use an IP range that overlaps with the existing subnets using CIDR calculator.

With 172.31.0.0/16 , you get 65,536 IPs . What should be the IP range that doesn’t overlaps with the existing subnets.

If you list the CIDR of the VPC, the CIDRs of any subnets you successfully created, and the CIDR you tried which you got the error with, then we can explain why that error happens.

Thanks for your quick response. I am trying to create a subnet with CIDR block with range 172.31.0.0/16. When I try enetring any in IPv4 subnet CIDR block , it throws an error CIDR Address overlaps with existing Subnet CIDR: 172.31.16.0/20. Please refer the attached screenshot for better refernce and understanding. How to handle this error…

172.31.16.0/20 would give you 4096 IPs. List the existing subnets and note their IP ranges. Then, create a new subnet that does not overlap with any existing subnets within your VPC.

Hi @Mohit97

You are likely not taking into account any existing subnets (there are 6 of them) and you will be overlapping with one of these.

Run the following command in the CloudShell terminal to list existing subnets. Any new subnet you create must not overlap any of these.

aws ec2 describe-subnets --query 'Subnets[*].{SubnetId:SubnetId, CidrBlock:CidrBlock}' --output table

A fresh account usually has all addresses from 172.31.0.0 - 172.31.95.255 covered by these existing subnets.

1 Like