AWS Builder Center

My AWS Cloud Journey: Understanding Public and Private Subnets

Learning AWS networking fundamentals is an important step towards becoming a Cloud and DevOps Engineer. In this article, I share my understanding of public and private subnets, internet gateways, NAT gateways, and how they work together to build a secure cloud architecture.

Understanding Public and Private Subnets in AWS

When I started learning Amazon Web Services (AWS), one of the first concepts I explored was networking. Understanding how resources communicate securely is essential when building applications in the cloud.
In this article, I will explain some important AWS networking concepts from a beginner's perspective.

1. What is an Amazon VPC?

An Amazon Virtual Private Cloud (VPC) is a logically isolated network where we can launch AWS resources.
Think of a VPC as your own private network inside AWS.
Within a VPC, we can create subnets, configure routing, and control network traffic.

2. What is a Public Subnet?

A public subnet is a subnet that has a route to an Internet Gateway.
For example, we might place:
  • Public-facing web servers
  • Load balancers
  • Bastion hosts
An Internet Gateway allows resources with appropriate public IP addressing and security configuration to communicate with the internet.

3. What is a Private Subnet?

A private subnet does not have a direct route to an Internet Gateway.
We typically place resources that should not be directly accessible from the public internet, such as:
  • Databases
  • Internal application servers
  • Backend services
This helps reduce the attack surface of our infrastructure.

4. What is an Internet Gateway?

An Internet Gateway (IGW) connects a VPC to the internet.
For an instance to communicate directly with the internet, it also needs suitable routing, public IP addressing, and security rules.

5. What is a NAT Gateway?

A NAT Gateway allows resources in a private subnet to initiate outbound connections to the internet without accepting unsolicited inbound connections through that NAT Gateway.
For example, a private EC2 instance might need to download software updates.
Instead of making the instance publicly accessible, we can route its outbound internet traffic through a NAT Gateway located in a public subnet.

6. How Do These Components Work Together?

Consider a simple web application architecture:
  • Users access the application through a public-facing load balancer.
  • Application servers run in private subnets.
  • Databases are kept in private subnets.
  • Private application servers use a NAT Gateway when they need outbound internet access.
This architecture separates publicly accessible components from internal resources.

7. What I Learned

The biggest lesson for me is that cloud networking is not just about connecting resources. It is also about controlling how resources communicate.
Understanding VPCs, subnets, route tables, Internet Gateways, and NAT Gateways provides a strong foundation for learning AWS architecture and DevOps.
I am continuing to explore AWS through practical exercises and hands-on projects.
What AWS networking concept should beginners learn next?
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