In AWS networking, what is a VPC and the difference between a public and a private subnet?
Options
- A VPC is your private AWS network; public subnets route to an Internet Gateway (Correct option)
- A VPC is a type of database; subnets are used to store files
- Public subnets are encrypted; private subnets have no encryption
- A VPC is a CDN; public and private subnets are cache layers
Answer
A VPC is your private virtual network in AWS; a public subnet has a route to an Internet Gateway, a private subnet does not (it reaches the internet only through a NAT Gateway)
Why
A VPC (Virtual Private Cloud) is an isolated network you define with an IP range (CIDR, e.g. 10.0.0.0/16), divided into subnets in different Availability Zones.
- Public subnet: route table sends
0.0.0.0/0to an Internet Gateway; resources can have public IPs (load balancers, bastion hosts). - Private subnet: no direct inbound from the internet; outbound goes through a NAT Gateway placed in a public subnet. Put app servers and databases here.
Azure equivalent: Virtual Network (VNet) and subnets.
Remember
Public subnet = route to Internet Gateway. Private = no direct route.