why VPC is /16 and why subnets are /24 like 10.0.1.0/24, 10.0.2.0/24, and how to pick them correctly. Here’s the practical way.
1) Start with the VPC size (10.0.0.0/16)
10.0.0.0/16 means you have:
-
IP range: 10.0.0.0 → 10.0.255.255
-
Total addresses: 65,536
People choose /16 because it gives enough room to split into many subnets across multiple AZs (public + private + DB + future), without redoing networking later.
2) Then decide subnet size (why /24 is common)
10.0.1.0/24 means:
-
IP range: 10.0.1.0 → 10.0.1.255
-
Total addresses: 256
-
Usable is less because AWS reserves 5 IPs per subnet (first 4 and last 1), so usable ≈ 251
So a /24 subnet gives you roughly 251 usable IPs, which is a nice practical “standard” size for:
-
ALB, NAT, small/medium EC2 fleets, EKS nodes, etc.
3) The “how to choose” rule (simple planning logic)
Step A — Decide how many subnet types you need
A typical production layout (2 AZ) needs:
-
Public subnets (ALB, NAT GW, bastion)
-
Private app subnets (EC2/EKS nodes)
-
Private DB subnets (RDS/ElastiCache)
So in 2 AZs, you’ll likely create 6 subnets minimum (3 types × 2 AZ).
Step B — Pick a consistent pattern
Example inside 10.0.0.0/16:
Public
-
public-a:
10.0.1.0/24 -
public-b:
10.0.2.0/24
Private-App
-
private-app-a:
10.0.11.0/24 -
private-app-b:
10.0.12.0/24
Private-DB
-
private-db-a:
10.0.21.0/24 -
private-db-b:
10.0.22.0/24
Why this pattern is nice:
-
Easy to read and troubleshoot
-
Easy to expand later (you still have a LOT of space left)
4) When NOT to use /24 (when to go bigger/smaller)
Use /23 (≈ 507 usable) or /22 (≈ 1019 usable) if:
-
You plan EKS with many nodes/pods
-
You expect large autoscaling
-
You’ll run lots of ENIs (AWS networking gets IP-hungry)
Use /25 or /26 if:
-
It’s a small lab/dev environment
-
You want tighter IP usage
(But many teams still keep /24 even for dev for simplicity.)
5) Quick cheat formula
-
Want many subnets + easy future growth → VPC /16
-
Want a standard subnet size that “usually works” → Subnets /24
-
Want EKS/large scale → Private subnets bigger than /24
now we go deep into CIDR math ๐ฅ
Let’s break 10.0.0.0/16 step-by-step so you understand it forever.
1️⃣ What does /16 actually mean?
IP addresses are 32 bits.
Example:
In binary:
The /16 means:
๐ First 16 bits are fixed (network part)
๐ Remaining 16 bits are available for hosts
So:
2️⃣ Why 65,536 addresses?
If 16 bits are available for hosts:
That’s the total number of combinations possible with 16 bits.
So:
Because:
-
The 3rd octet (0–255) → 256 possibilities
-
The 4th octet (0–255) → 256 possibilities
So:
That’s how.
3️⃣ Why does it go to 10.0.255.255?
Because /16 means:
-
First 2 octets fixed:
10.0 -
Last 2 octets free
So last two octets range:
So full range:
4️⃣ General CIDR Formula (Remember This Forever)
Total IPs in CIDR:
For /16:
5️⃣ Quick Comparison to Make It Crystal Clear
| CIDR | Host Bits | Total IPs |
|---|---|---|
| /24 | 8 | 256 |
| /23 | 9 | 512 |
| /22 | 10 | 1024 |
| /16 | 16 | 65,536 |
See the pattern? ๐ฅ
6️⃣ Important AWS Note
AWS reserves 5 IPs per subnet (not per VPC):
-
Network address
-
Router
-
DNS
-
Future use
-
Broadcast
So in a /24 (256 IPs):
Usable = 251
๐ฏ Final Simple Mental Model
Think like this:
10.0.0.0/16
Means:
You can change X and Y from 0–255
That gives: