Explain internet gateway versus NAT gateway and when you use each.
BeginnerScenarioVPC & Cloud Network Design
Answer
Situation read → They solve opposite directions of internet access.
What I'd do →
- Use an IGW for resources with public IPs that must be reachable from and reach the internet (ALB, bastions)
- Use a NAT gateway so private instances can start outbound connections (package updates, API calls) without being reachable inbound
- Place the NAT gateway in a public subnet with an Elastic IP
- Point private route tables
0.0.0.0/0at the NAT gateway
Why → NAT gateways translate the private source to the NAT's Elastic IP and only allow return traffic for connections initiated from inside.
Interview tip → Mention NAT gateway cost (hourly plus per GB) because it is a favourite follow-up.
More on VPC & Cloud Network Design
What makes a subnet public versus private in AWS?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