Amazon Web Services – Sizing a VPC and Subnet
Shorter post here but wanted to quickly share some information regarding IP addressing within an AWS VPC and subnets.
As you might know, when you create a VPC you specify the CIDR block that you’ll be utilizing. Once your VPC is created, you’ll need to create subnets within that CIDR block for resources to attach to. For example, if you create a VPC using a CIDR block of 10.0.0.0/16, you can create subnets using 10.0.x.x/x. Therefore subnets created within this VPC could be 10.0.1.0/24, 10.0.2.0/24, etc. These subnets don’t have to be limited to a /24, they can be larger if needed to accommodate any business requirements you might have. AWS limits the size of a subnet between a /16 at the largest to a /28 as the smallest.
It’s important to know that AWS reserves (5) IP addresses in EVERY subnet that is created and they are not available for your use. To be more specific, the first 4 address of a subnet, and the last, are reserved and not available for use. As an example, in the subnet of 10.0.0.0/24, the IP addresses that are reserved are:
- 10.0.0.0 – Network Address
- 10.0.0.1 – Reserved by AWS for the VPC router
- 10.0.0.2 – Reserved by AWS for mapping to the Amazon-Provided DNS
- 10.0.0.3 – Reserved for Future Use
- 10.0.0.255 – Network Broadcast Address. AWS does not support broadcast in a VPC, therefore they reserve this address.
With this in mind, I created a quick chart to reference the number of hosts available in a subnet within an AWS VPC.