Cloud security Public and private subnets 3 min read
What makes a subnet public or private?
An EC2 instance is in a subnet named private-apps. Is it actually private?
-
The route table defines the subnet type
In AWS, a subnet associated with a route table that sends internet-bound traffic to an internet gateway is public. Without that route, it is private by this definition—even if someone gave it a reassuring name.
In short Look at the route table, not the subnet label.
-
Internet reachability needs more than a route
For internet traffic to reach an IPv4 instance through an internet gateway, the instance also needs a public IPv4 address or Elastic IP. Security groups and network ACLs must permit the traffic too.
In short Route, address, and network rules combine to determine reachability.
-
Private workloads can use controlled outbound paths
A private subnet can send outbound traffic through a NAT device or a service endpoint without accepting unsolicited internet connections through an internet gateway. Choose the path the application actually needs.
In short Outbound access does not automatically mean inbound reachability.
What a private subnet doesn’t guarantee
“Private” does not mean isolated from every network. Peering, VPNs, transit gateways, NAT, and service endpoints create other paths that need review.
This definition describes AWS VPC routing. Other platforms use different network constructs.
Keep this
Check routes, addresses, and firewall rules together.
Do not infer exposure from a subnet label. Inspect its route table, resource addresses, security groups, and network ACLs.- Route
- A route to an internet gateway makes the subnet public.
- Address
- Public reachability requires an address routable from the internet.
- Filter
- Security groups and network ACLs still control traffic.