Course contentsShow
← Cloud and Infrastructure
Lesson 189 of 2,9894. Cloud Networking BasicsFree lesson

Public vs Private Subnets

Distinguish between public subnets with internet routes and private subnets without direct internet access.

Public vs Private Subnets

What you'll learn: How to distinguish between subnets that allow direct internet access and those that remain isolated from the public internet.

The Core Difference

Now that you've learned about internet gateways and how they attach to your virtual network, it's time to understand the fundamental distinction between public and private subnets.

A public subnet is one whose route table contains a route directing traffic to an internet gateway. This means resources in that subnet can communicate directly with the internet (both sending and receiving traffic).

A private subnet has no such route. Its route table doesn't point to an internet gateway, so resources inside cannot directly reach or be reached from the internet.

Think of It Like Building Security

Imagine an office building:

  • Public subnet = The lobby. Visitors can walk in from the street, and employees can step outside freely. There's a direct path between inside and outside.

  • Private subnet = The back offices. No direct street access. More secure, but you can't just walk outside without going through internal hallways first.

Why Does This Matter?

Public subnets are where you place resources that need direct internet access:

  • Web servers serving your application
  • Bastion hosts for administrative access
  • Load balancers receiving user traffic

Private subnets house resources that shouldn't be directly exposed:

  • Database servers
  • Application servers behind load balancers
  • Internal processing systems

The distinction is entirely controlled by the route table associated with each subnet—same network, different routing rules.

Key Takeaway: A subnet becomes "public" when its route table includes a route to an internet gateway; without that route, it remains "private" and isolated from direct internet access.