VPC Design

Subnet design, CIDR planning, route tables, internet gateway, NAT gateway, and multi-tier architectures.

Overview

A VPC (Virtual Private Cloud) is an isolated virtual network in AWS. Every VPC has a CIDR block (e.g., 10.0.0.0/16) defining its address space. Subnets are subdivisions of the VPC CIDR, each tied to one Availability Zone.

Subnet types

A subnet's type comes from its route table, that is, from where its traffic can go. There are three types.

  • Public subnets: the route table sends 0.0.0.0/0 to an Internet Gateway (IGW). Resources need a public or Elastic IP for direct internet connectivity.
  • Private subnets: there is no IGW route. The route table sends 0.0.0.0/0 to a NAT Gateway deployed in a public subnet, so outbound internet access works, but inbound internet access is not possible.
  • Isolated subnets: there is no internet route at all, only the local route inside the VPC. They hold databases (RDS, ElastiCache) and internal services.

Key concepts

  • Internet Gateway (IGW)
  • NAT Gateway
  • Route table
  • VPC Endpoint
  • Security group vs NACL

Interview questions

  • Design the VPC architecture for a three-tier web application that must be highly available across two AZs.
  • What is the difference between VPC peering, Transit Gateway, and PrivateLink? When do you use each?

Sign up free to read the full topic

More Networking topics

Start free on Cariara · Coding problems · System design studio