What makes a subnet public versus private in AWS?
BeginnerScenarioVPC & Cloud Network Design
Answer
Situation read → Subnets have no public/private flag; the difference is entirely the route table and the IP assignment.
What I'd do →
- Look at the subnet route table: a route
0.0.0.0/0 -> igw-xxxxmakes it public - Check that instances have a public or Elastic IP, otherwise the IGW route is useless for them
- Private subnets send
0.0.0.0/0to a NAT gateway or have no default route at all - Verify with
aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0abc
Why → The internet gateway only does 1:1 NAT for instances that already have a public IPv4 address.
Interview tip → Say that load balancers and NAT gateways go in public subnets, while application and database tiers stay private.
More on VPC & Cloud Network Design
Explain internet gateway versus NAT gateway and when you use each.BeginnerPrivate instances need to pull packages from the internet but must not be reachable from it. What do you set up?BeginnerWhy shouldn't production run in the default VPC?BeginnerPublic IP, Elastic IP and private IP: how do they differ on EC2?BeginnerWhy use SSM Session Manager instead of a bastion host?BeginnerYour private subnet instances reach S3 through the NAT gateway and the bill is large. What do you do?Beginner