AWS Newbie Tips Community

Cover image for What's the best AWS VPC CIDR and subnets calculation for a new VPC?
Jason Wright
Jason Wright

Posted on • Updated on

What's the best AWS VPC CIDR and subnets calculation for a new VPC?

I am thinking of building a new AWS VPC with a CIDR block of 172.168.0.0/16.

I don't want this VPC CIDR range to cross my existing VPC's. What CIDR can I use for my new VPC and then how do I decide what subnets I will need to create for 2 private and 2 public subnets.

Does anyone have a template they tend to reuse to keep things nice and tidy?

Latest comments (3)

Collapse
 
jenna profile image
Jenna

Here is a great resource for calculating CIDR blocks and subnets

CIDR Calculator

Collapse
 
lee profile image
Lee

I think a good template is to use a /24 range to divide the VPC CIDR range, here is an example based on your question:

VPC: 172.168.0.0/16

  • Subnet 1: 172.168.0.0/24
  • Subnet 2: 172.168.1.0/24
  • Subnet 3: 172.168.2.0/24
  • Subnet 4: 172.168.3.0/24

The if you wanted another

VPC: 173.168.0.0/16

  • Subnet 1: 173.168.0.0/24
  • Subnet 2: 173.168.1.0/24
  • Subnet 3: 173.168.2.0/24
  • Subnet 4: 173.168.3.0/24

From this you can easily determine to have thge subnets use a small or a bigger portion of the CIDR range.

It is mega important to ensure that you don't overlap with on prem or cross cloud/services CIDR blocks. Double, then triple check.

Collapse
 
jason profile image
Jason Wright

Thanks! Makes total sense!