InterviewHubPRO
Section Overview
Q9

Question 9 of 65

Part 2: Networking, VPC & Traffic Routing (6 - 20)

14%
AWS Cloud Architecture•Part 2: Networking, VPC & Traffic Routing (6 - 20)

Internet Gateway vs NAT Gateway vs NAT Instance.

In Simple Words:

  • Internet Gateway (IGW): Scalable, highly available gateway attached to your VPC allowing public subnets bidirectional internet access.
  • NAT Gateway: AWS-managed service in a public subnet that allows private subnet instances to make outbound internet calls (e.g., download security updates) while preventing external entities from initiating inbound connections.
  • NAT Instance: Legacy self-managed EC2 instance running NAT software; requires manual scaling and patching.
hcl
# Private route table pointing 0.0.0.0/0 to NAT Gateway:
resource "aws_route_table" "private" {
  vpc_id = aws_vpc.main.id
  route {
    cidr_block     = "0.0.0.0/0"
    nat_gateway_id = aws_nat_gateway.gw.id
  }
}