Designing AWS VPC subnets around five reserved IPs
In one line: VPC CIDR is /16 to /28, five addresses are reserved in every subnet, and a /28 leaves only 11. Sizing rules, an availability-zone layout and Terraform.
When you create an AWS VPC the IPv4 CIDR must be between /16 (65,536 addresses) and /28 (16). Subnets follow the same limits, must sit inside the VPC range and cannot overlap. The console error "IPv4 block sizes must be between a /16 netmask and /28 netmask" is this rule being enforced.
Five addresses disappear per subnet
AWS adds three reservations to the textbook two (network and broadcast).
| Address | Reserved for |
|---|---|
| 10.0.0.0 | Network address |
| 10.0.0.1 | VPC router |
| 10.0.0.2 | AWS DNS (VPC base plus two) |
| 10.0.0.3 | Future use |
| 10.0.0.255 | Broadcast — VPCs do not broadcast, but the address is held |
So a /28 leaves 11 of 16 addresses for instances, a /27 leaves 27, a /26 leaves 59 and a /24 leaves 251. The smaller the subnet, the larger the share that disappears: 31% of a /28.
The real consumption is higher
Counting servers is not enough. Each instance can hold several elastic network interfaces and secondary IPs, and NAT gateways, Application Load Balancers, VPC endpoints, Lambda functions and EKS pods all take addresses. Size a subnet by every network interface it could ever host, not by today's server count.
A three-zone layout
A common split of 10.0.0.0/16 into public and private subnets across three availability zones.
| Subnet | CIDR | Usable | Purpose |
|---|---|---|---|
| public-a | 10.0.0.0/20 | 4,091 | ALB, bastion |
| public-b | 10.0.16.0/20 | 4,091 | ALB |
| public-c | 10.0.32.0/20 | 4,091 | ALB |
| private-a | 10.0.48.0/20 | 4,091 | apps and databases |
| private-b | 10.0.64.0/20 | 4,091 | apps and databases |
| private-c | 10.0.80.0/20 | 4,091 | apps and databases |
Six /20 blocks end at 10.0.80.0/20, leaving everything from 10.0.96.0/20 onward free. Leaving a large contiguous remainder matters for later VPN attachments and VPC peering.
Carrying it into Terraform
locals {
vpc_cidr = "10.0.0.0/16"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
private = { for i, az in local.azs :
az => cidrsubnet(local.vpc_cidr, 4, i + 3) }
}
resource "aws_subnet" "private" {
for_each = local.private
vpc_id = aws_vpc.main.id
cidr_block = each.value
availability_zone = each.key
}
cidrsubnet("10.0.0.0/16", 4, 3) adds four bits to make a /20 and selects block number three, which is 10.0.48.0/20. CidrPlan shows this calculation for every subnet in a split and generates the same code.
Everything is calculated in your browser. The ranges you type are not stored on a server.
Back to the CIDR calculatorFrequently asked questions
Can an AWS VPC be smaller than a /28?
No. Both VPCs and subnets need at least a /28. Five of its 16 addresses are reserved, leaving 11.
Do the five reservations apply to every subnet?
Yes: the first four and the last address of each subnet. A BYOIP range is the exception — there the first and last addresses can be used.
Can a subnet be resized later?
A VPC CIDR can only be added to, not shrunk, and a subnet CIDR cannot be changed after creation. Size generously at the start.
Sources
Read next
- CIDR notation and subnet masks from the ground upWhat 192.0.2.0/24 actually means: network and broadcast addresses, usable host counts, subnet masks and wildcard masks in one place.
- VLSM: splitting a range by real host requirementsWhy equal-size FLSM wastes space, and how VLSM places the largest requirement first, aligns every block and reports the leftover space.
- IPv6 notation and exact 128-bit arithmeticEight groups, :: compression and RFC 5952, why /64 is the standard subnet, and the Subnet-Router anycast that replaces broadcast.