Cloud VPC CIDR Planning with 3 Availability Zones

Intermediate Design

Question

You are setting up a cloud VPC with CIDR 10.0.0.0/16. The VPC spans 3 availability zones (AZ-A, AZ-B, AZ-C). Each AZ needs 3 subnets: public, private, and database. Design the addressing so that each AZ block is the same size and each tier is consistent across AZs. Each AZ should receive a /20 block, and each subnet within an AZ a /24.

Given

{
  "vpc_cidr": "10.0.0.0/16",
  "availability_zones": 3,
  "tiers": [
    "public",
    "private",
    "database"
  ]
}

Answer

{
  "az_blocks": [
    {
      "az": "AZ-A",
      "block": "10.0.0.0/20"
    },
    {
      "az": "AZ-B",
      "block": "10.0.16.0/20"
    },
    {
      "az": "AZ-C",
      "block": "10.0.32.0/20"
    }
  ],
  "subnets": [
    {
      "az": "AZ-A",
      "tier": "public",
      "subnet": "10.0.0.0/24",
      "usable": 254
    },
    {
      "az": "AZ-A",
      "tier": "private",
      "subnet": "10.0.1.0/24",
      "usable": 254
    },
    {
      "az": "AZ-A",
      "tier": "database",
      "subnet": "10.0.2.0/24",
      "usable": 254
    },
    {
      "az": "AZ-B",
      "tier": "public",
      "subnet": "10.0.16.0/24",
      "usable": 254
    },
    {
      "az": "AZ-B",
      "tier": "private",
      "subnet": "10.0.17.0/24",
      "usable": 254
    },
    {
      "az": "AZ-B",
      "tier": "database",
      "subnet": "10.0.18.0/24",
      "usable": 254
    },
    {
      "az": "AZ-C",
      "tier": "public",
      "subnet": "10.0.32.0/24",
      "usable": 254
    },
    {
      "az": "AZ-C",
      "tier": "private",
      "subnet": "10.0.33.0/24",
      "usable": 254
    },
    {
      "az": "AZ-C",
      "tier": "database",
      "subnet": "10.0.34.0/24",
      "usable": 254
    }
  ],
  "remaining": "10.0.48.0/20 through 10.0.255.255 (13 \u00d7 /20 blocks free)"
}

Try to solve it first, then click Reveal Answer

Step-by-Step Explanation

Step 1: Understand the VPC space

10.0.0.0/16 = 65,536 addresses total, providing plenty of room for multi-AZ deployment.

Step 2: Assign a /20 per availability zone

/20 = 4,096 addresses per AZ. With 3 tiers of /24 per AZ, each AZ uses 3 × 256 = 768 addresses, well within the /20.

/20 boundaries fall at multiples of 4,096 (every 16 in the third octet):

AZ-A: 10.0.0.0/20   (10.0.0.0  - 10.0.15.255)
AZ-B: 10.0.16.0/20  (10.0.16.0 - 10.0.31.255)
AZ-C: 10.0.32.0/20  (10.0.32.0 - 10.0.47.255)

Step 3: Allocate /24 subnets within each AZ

Each tier gets consecutive /24 subnets starting at the AZ base address:

AZ-A:
  public:   10.0.0.0/24   (10.0.0.1 - 10.0.0.254)
  private:  10.0.1.0/24   (10.0.1.1 - 10.0.1.254)
  database: 10.0.2.0/24   (10.0.2.1 - 10.0.2.254)

AZ-B:
  public:   10.0.16.0/24  (10.0.16.1 - 10.0.16.254)
  private:  10.0.17.0/24
  database: 10.0.18.0/24

AZ-C:
  public:   10.0.32.0/24
  private:  10.0.33.0/24
  database: 10.0.34.0/24

Step 4: Cloud-specific considerations

Public subnets (AZ-A/B/C public): - Attach an Internet Gateway route: 0.0.0.0/0 → igw-xxx - Instances here can have public IPs - Place load balancers, NAT gateways, bastion hosts

Private subnets (AZ-A/B/C private): - Route internet via NAT Gateway in the same AZ: 0.0.0.0/0 → nat-xxx - Application servers, microservices run here

Database subnets (AZ-A/B/C database): - No internet route (fully isolated) - Only reachable from private subnets via security group rules - RDS Multi-AZ, ElastiCache clusters

Step 5: Security group design

Internet → ALB (public subnet) → App (private subnet) → DB (database subnet)
                                                              ↑
                                    Only port 5432/3306 from private subnet CIDR

This tiered approach is the standard AWS/GCP/Azure VPC pattern for production workloads.

Related Terms

More Design Worksheets