AWS Builder Center
AWS VPC Architecture Explained: Public & Private Subnets with NAT Gateway

AWS VPC Architecture Explained: Public & Private Subnets with NAT Gateway

Learn how AWS VPC, public and private subnets, route tables, Internet Gateway and NAT Gateway work together. A simple architecture diagram with practical implementation steps for beginners.

431001

Introduction

Amazon VPC (Virtual Private Cloud) allows us to create an isolated network in AWS and securely manage cloud resources.

Architecture Overview

This architecture contains:
  • VPC: Main private network (10.0.0.0/16).
  • Public Subnet: 10.0.1.0/24 – Hosts internet-facing resources.
  • Private Subnet: 10.0.2.0/24 – Hosts resources without direct internet access.
  • Internet Gateway (IGW): Connects the VPC to the internet.
  • NAT Gateway: Allows private resources to access the internet.
  • Route Tables: Control network traffic destinations.

Practical Steps

  1. Create a VPC with CIDR 10.0.0.0/16.
  1. Create public and private subnets.
  1. Attach an Internet Gateway to the VPC.
  1. Create a public route table: 0.0.0.0/0 → IGW.
  1. Create a NAT Gateway in the public subnet and assign an Elastic IP.
  1. Create a private route table: 0.0.0.0/0 → NAT Gateway.
  1. Launch EC2 instances and configure security groups.

How Traffic Flows

  • Public EC2 → Internet Gateway → Internet.
  • Private EC2 → NAT Gateway → Internet.
Important: NAT Gateway allows outbound internet connectivity for private resources without allowing unsolicited inbound internet connections.

Conclusion

Understanding VPC architecture is an essential step towards learning AWS networking, cloud security and infrastructure management.
I created this simplified architecture diagram to make the practical easier to understand for beginners.
Happy Learning!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article