Demystifying Amazon VPC: A Practical Guide to Subnets, Route Tables, and Internet Gateways
A clear, practical breakdown of Amazon VPC fundamentals, explaining CIDR blocks, public vs. private subnets, NAT Gateways, and baseline network security.
When deploying infrastructure on AWS, networking is the backbone of your entire architecture. **Amazon Virtual Private Cloud (Amazon VPC)** lets you provision a logically isolated section of the AWS Cloud where you can launch resources in a virtual network that you define.
Understanding how the core components fit together is essential for keeping workloads both accessible and secure.
---
### 1. The Foundation: CIDR Blocks and IP Addressing
Every VPC requires an assigned IPv4 Classless Inter-Domain Routing (CIDR) block (for example, `10.0.0.0/16`). This range dictates how many internal private IP addresses are available across your entire network.
* **Sizing carefully:** You cannot change or overlap primary CIDR blocks once configured.
* **Subnetting:** You divide the primary VPC block into smaller, contiguous blocks called **subnets** (e.g., `10.0.1.0/24`), each assigned to a single Availability Zone (AZ) to ensure high availability.
---
### 2. Public vs. Private Subnets: What’s the Difference?
The primary distinction between public and private subnets comes down to their routing table rules:
* **Public Subnets:** Connected directly to an **Internet Gateway (IGW)** via their route table (`0.0.0.0/0 -> igw-xxxx`). Resources inside can send and receive traffic directly to/from the public internet (ideal for Application Load Balancers or public-facing web servers).
* **Private Subnets:** Have no direct route to an Internet Gateway. Compute instances inside (such as backend application servers or Amazon RDS databases) remain hidden from the outside world.
---
### 3. Outbound Internet for Private Workloads: NAT Gateways
Private workloads often need to download external software updates, install dependencies, or contact third-party APIs without accepting inbound internet connections.
* Place a **NAT Gateway** in a **public subnet**.
* Update the **private subnet's route table** to direct outbound internet traffic (`0.0.0.0/0`) through that NAT Gateway.
* The NAT Gateway translates internal IP addresses and routes traffic out through the Internet Gateway, while actively blocking all unsolicited inbound connections.
---
### 4. Defense in Depth: Security Groups vs. Network ACLs
| Security Layer | Scope | State | Rule Processing |
| :--- | :--- | :--- | :--- |
| **Security Groups** | Instance level (Virtual firewall) | **Stateful** (Return traffic is automatically allowed) | Evaluates all rules before deciding to allow |
| **Network ACLs (NACLs)** | Subnet level (Boundary protection) | **Stateless** (Return traffic must be explicitly allowed) | Evaluates rules in strict numerical order |
A secure baseline pairs permissive, stateless NACLs with tight, least-privilege Security Groups targeting specific ports (such as opening Port 443 strictly for inbound HTTPS).
---
### Conclusion
A resilient AWS architecture follows a multi-tier VPC blueprint: placing user-facing load balancers in public subnets across multiple Availability Zones, while nesting backend compute and databases deep inside isolated private subnets. Getting this network topology right from the start ensures security and scalability as your projects expand.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article