Instances in a private subnet cannot reach the internet to download packages. What do you add?
BeginnerScenarioVPC and Networking
Answer
Situation read → Private subnets need an outbound path, typically a NAT gateway in a public subnet.
What I'd do →
- Create a NAT gateway in a public subnet with an Elastic IP
- Add
0.0.0.0/0 -> nat-0abcto the private route table - Test from the instance:
curl -sI https://example.com - For one NAT per AZ, add one route table per AZ
Why → NAT gives outbound-only access; inbound connections from the internet still cannot be initiated.
Interview tip → Mention NAT cost and the gateway endpoint alternative for S3 and DynamoDB.
More on VPC and Networking
What is a VPC and what are the CIDR constraints?BeginnerWhat makes a subnet public or private?BeginnerHow do route tables work, including the local route and longest-prefix match?IntermediateInternet Gateway vs NAT Gateway: what does each do?BeginnerNAT Gateway vs NAT instance?IntermediateSecurity group vs network ACL: compare them.Beginner