AWS VPC and Subnetting with CIDR Notation

Amazon Virtual Private Cloud (Amazon VPC) enables you to deploy AWS resources into a logically isolated virtual network that you define. This network architecture mirrors a traditional on-premises data-center environment — yet leverages AWS’s scalable, resilient infrastructure and built-in security. Structuer of VPC in AWS — Taken from official documentation While having detailed knowledge of these concepts is not mandatory for configuring a VPC, it’s essential to have a basic understanding of IP addresses and subnets for effective network setup. VPC CIDR Notation: Refer to the image below for a detailed breakdown of an IPv4 address, highlighting how bits are divided between the network and host portions. structure of an IP address The IP address consist of 4 bytes in size. 1 byte is technically 4 bits. So in total there will be 32 bits as shown above. So when you give 10.0.0.0/16 the first 16 bytes will be reserved for network portion. Structure of VPC CIDR notation In the next figure, we’ll examine the bit-level configuration of our VPC and its subnets to illustrate how the network and host portions are defined. VPC CIDR notation Since /16 Reserves the first 16 bits for the network, and the remaining 16 bits are used for subnets and hosts. This results in: Total IP addresses : ²¹⁶ = 65,536 Usable IP addresses : 65,534 It’s important to note that within each subnet, 2 IP addresses are reserved — one for network identification and the other for broadcast purposes. As a result, these addresses are not available for assigning to resources. Before configuring your VPCs and subnets, it’s crucial to plan ahead. You should have a clear understanding of the number of VPCs required, the subnets within each VPC, and the approximate number of resources (such as EC2 instances, containers, or services) that will be deployed. Proper planning ensures efficient IP allocation and scalability of your infrastructure. Subnetting using CIDR Notation: A subnet is a range of IP addresses in your VPC. You can create AWS resources, such as EC2 instances, in specific subnets. Each subnet must reside entirely within one Availability Zone and cannot span zones. By launching AWS resources in separate Availability Zones, you can protect your applications from the failure of a single Availability Zone. In a VPC, subnets provide an additional layer of logical isolation by partitioning the network into smaller segments. This finer-grained segmentation enhances security boundaries, streamlines traffic management, and simplifies resource organisation across your infrastructure. AWS Subnet Architecture — Taken from AWS Documentation Now, move on to configuring the IPv4 Subnet CIDR Block. This should be a valid subset of your VPC’s CIDR range. For example, if your VPC uses 10.0.0.0/16You can define a subnet, such as 10.0.1.0/24 or10.0.0.0/20 depending on the number of resources you plan to deploy within the subnet. Let's dive back to that older VPC IP block diagram. In this setup, we’ve chosen 10.0.0.0/16 as the CIDR block for our VPC. This means the first 16 bits (10.0) are reserved for network identification, while the remaining 16 bits (0.0) are available for defining subnets and host addresses. The 10.0.x.x range is part of the private IP space, commonly used for internal networking. When allocating subnets, the CIDR block should fall within the /16 to /28 range to ensure proper IP management, keeping in mind that at least 2 IPs in each subnet are reserved for network and broadcast addresses. For our current implementation, we are using a /24 CIDR for each subnet. For example, subnet-1 is configured with the block 10.0.0.0/24, providing up to 254 usable IP addresses within that range in the subnet-1. Subnet-1 CIDR notation In this example, we’ve only scratched the surface. By tuning the number of bits you reserve in your CIDR mask, you gain precise control over both the total number of subnets and the IP capacity of each. For instance, if our VPC is 10.0.0.0/16 and we’re using /24 for each subnet: subnet-1 10.0.1.0/24 subnet-2 10.0.2.0/24 subnet-3 10.0.3.0/24 Subnet-2 CIDR notation Next, let’s break down the formulas you’ll use to calculate each of these values: In this project, we’ve defined a VPC CIDR of 10.0.0.0/16 and are using a /24 mask for each subnet. The table below summarizes how many subnets you can create and the number of hosts available in each segment. I trust this overview has clarified AWS VPCs and subnet CIDR notation. If you have any questions, please leave a comment below — I’ll be happy to help.

Apr 25, 2025 - 07:19
 0
AWS VPC and Subnetting with CIDR Notation

Amazon Virtual Private Cloud (Amazon VPC) enables you to deploy AWS resources into a logically isolated virtual network that you define. This network architecture mirrors a traditional on-premises data-center environment — yet leverages AWS’s scalable, resilient infrastructure and built-in security.


Structuer of VPC in AWS — Taken from official documentation

While having detailed knowledge of these concepts is not mandatory for configuring a VPC, it’s essential to have a basic understanding of IP addresses and subnets for effective network setup.

VPC CIDR Notation:

Refer to the image below for a detailed breakdown of an IPv4 address, highlighting how bits are divided between the network and host portions.


structure of an IP address

The IP address consist of 4 bytes in size. 1 byte is technically 4 bits. So in total there will be 32 bits as shown above. So when you give 10.0.0.0/16 the first 16 bytes will be reserved for network portion.


Structure of VPC CIDR notation

In the next figure, we’ll examine the bit-level configuration of our VPC and its subnets to illustrate how the network and host portions are defined.


VPC CIDR notation

Since /16 Reserves the first 16 bits for the network, and the remaining 16 bits are used for subnets and hosts. This results in:

  • Total IP addresses : ²¹⁶ = 65,536
  • Usable IP addresses : 65,534

It’s important to note that within each subnet, 2 IP addresses are reserved — one for network identification and the other for broadcast purposes. As a result, these addresses are not available for assigning to resources.

Before configuring your VPCs and subnets, it’s crucial to plan ahead. You should have a clear understanding of the number of VPCs required, the subnets within each VPC, and the approximate number of resources (such as EC2 instances, containers, or services) that will be deployed. Proper planning ensures efficient IP allocation and scalability of your infrastructure.

Subnetting using CIDR Notation:

A subnet is a range of IP addresses in your VPC. You can create AWS resources, such as EC2 instances, in specific subnets. Each subnet must reside entirely within one Availability Zone and cannot span zones. By launching AWS resources in separate Availability Zones, you can protect your applications from the failure of a single Availability Zone.

In a VPC, subnets provide an additional layer of logical isolation by partitioning the network into smaller segments. This finer-grained segmentation enhances security boundaries, streamlines traffic management, and simplifies resource organisation across your infrastructure.


AWS Subnet Architecture — Taken from AWS Documentation

Now, move on to configuring the IPv4 Subnet CIDR Block. This should be a valid subset of your VPC’s CIDR range. For example, if your VPC uses 10.0.0.0/16You can define a subnet, such as 10.0.1.0/24 or10.0.0.0/20 depending on the number of resources you plan to deploy within the subnet. Let's dive back to that older VPC IP block diagram.

In this setup, we’ve chosen 10.0.0.0/16 as the CIDR block for our VPC. This means the first 16 bits (10.0) are reserved for network identification, while the remaining 16 bits (0.0) are available for defining subnets and host addresses. The 10.0.x.x range is part of the private IP space, commonly used for internal networking.

When allocating subnets, the CIDR block should fall within the /16 to /28 range to ensure proper IP management, keeping in mind that at least 2 IPs in each subnet are reserved for network and broadcast addresses. For our current implementation, we are using a /24 CIDR for each subnet. For example, subnet-1 is configured with the block 10.0.0.0/24, providing up to 254 usable IP addresses within that range in the subnet-1.


Subnet-1 CIDR notation

In this example, we’ve only scratched the surface. By tuning the number of bits you reserve in your CIDR mask, you gain precise control over both the total number of subnets and the IP capacity of each. For instance, if our VPC is 10.0.0.0/16 and we’re using /24 for each subnet:

subnet-1 10.0.1.0/24
subnet-2 10.0.2.0/24
subnet-3 10.0.3.0/24


Subnet-2 CIDR notation

Next, let’s break down the formulas you’ll use to calculate each of these values:

In this project, we’ve defined a VPC CIDR of 10.0.0.0/16 and are using a /24 mask for each subnet. The table below summarizes how many subnets you can create and the number of hosts available in each segment.

I trust this overview has clarified AWS VPCs and subnet CIDR notation. If you have any questions, please leave a comment below — I’ll be happy to help.