Simply Calculate AWS Subnet's CIDR Blocks For VPC


Don't want to read? Watch Video:

VPC and Subnet Basics (AWS Definition):

A virtual private cloud (VPC) is a virtual network dedicated to your AWS account. It is logically isolated from other virtual networks in the AWS Cloud. You can launch your AWS resources, such as Amazon EC2 instances, into your VPC.

When you create a VPC, you must specify a range of IPv4 addresses for the VPC in the form of a Classless Inter-Domain Routing (CIDR) block; for example, This is the primary CIDR block for your VPC.


What is CIDR Blocks ?

It is a Classless Inter-Domain Routing.


How to decide IPv4 address range ?

While creating a VPC, AWS recommend that you specify a CIDR block (of /16 or smaller network prefix) from the iana (Internet Assigned Numbers Authority) standard private IPv4 address ranges:

  • - (/8 prefix)

  • - (/12 prefix)

  • - (/16 prefix)

Available IPs Depends On N/W Prefix:

Example: /16 (n/w prefix)

Total Available Host Bits = Total Bits – n/w Prefix
Total Available IPs = 2^ Total Available Host Bits
Total Available Host Bits =  32 bits – 16bits = 16
Total Available IPs = 2^16 = 65536 Ips

How to choose CIDR block for VPC?


It’s totally depends on your IP addresses requirement and numbers of subnets you want to create.

For example, we have requirement of 200 Ips and want to allocate 100 Ips in subnet-1 and remaining 100 ips in subnet-2

Lets find out total available Ips using different n/w prefix.

  • Example-1: /16 (n/w prefix) => 65536 Ips
  • Example-2: /20 (n/w prefix) => 4096 Ips
  • Example-3: /23 (n/w prefix) => 512 Ips
  • Example-4: /24 (n/w prefix) => 256 Ips (Most suitable)
  • Example-5: /25 (n/w prefix) => 128 Ips

Lets calculate CIDR block for subnets:

Example-1: /25 (n/w prefix) => 32-25 = 7 = 2^7 = 128 Ips (Most suitable)

Example-2: /26 (n/w prefix) => 32-26 = 6 = 2^6 = 64 Ips (less, as we need 100 Ips)

Example-3: /27 (n/w prefix) => 32-27 = 5 = 2^5 = 32 Ips (less, as we need 100 Ips)

Example-4: /28 (n/w prefix) => 32-28 = 4 = 2^4 = 16 Ip (less, as we need 100 Ips)


AWS Reserved 5 IP Addresses:

The first four IP addresses and the last IP address in each subnet CIDR block are not available for you to use, and cannot be assigned to an instance. For example, in a subnet with CIDR block, the following five IP addresses are reserved:

  • Network address.
  • Reserved by AWS for the VPC router.
  • Reserved by AWS for future use.
  • Reserved by AWS for future use.
  • Reserved for Network broadcast address.

For More Details:

Calculate Subnet CIDR Blocks Tool:

There are many tools available to help you calculate subnet CIDR blocks.

My favorite one is :

Happy Learning AWS Services!!!! :) Still Doubts? lets put your questions in below comment box! Thanks! 

Please like and subscribe this channel. Your 1 subscription is very important to grow channel!

Simply Calculate AWS Subnet's CIDR Blocks For VPC Simply Calculate AWS Subnet's CIDR Blocks For VPC Reviewed by Web Technology Funda on 9:40:00 AM Rating: 5

No comments

Free! Free!Free! Subscribe to Get Free PHP (Magento) tutorial Update in Your Inbox!!! Hurry Up!!!