Private instances need to pull packages from the internet but must not be reachable from it. What do you set up?
BeginnerScenarioVPC & Cloud Network Design
Answer
Situation read → Standard outbound-only requirement.
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 subnet route table - Allow outbound 80/443 in the security group (the default allows all outbound)
- Test from the instance with
curl -sI https://example.com
Why → Inbound traffic cannot start connections to the private instances because no route or public IP points to them.
Interview tip → Offer VPC endpoints or a package mirror as the cheaper, more secure alternative.
More on VPC & Cloud Network Design
What makes a subnet public versus private in AWS?BeginnerExplain internet gateway versus NAT gateway and when you use each.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