Introduction
In AWS, an Internet Gateway (IGW) connects a VPC to the public internet and enables two-way communication (both inbound and outbound). A NAT Gateway (NGW) allows resources in private subnets to access the internet outbound only, while keeping them inaccessible from the public internet.

Internet Gateway (IGW)
An Internet Gateway acts as a bridge between your VPC and the internet. It is a horizontally scaled, highly available, AWS-managed component that provides direct internet connectivity for resources within a VPC. Internet Gateways are free to use (there is no hourly charge).
Key Features of an Internet Gateway (IGW)
Enables both inbound and outbound internet traffic.
Primarily used with public subnets.
Instances must have a public IPv4 address or an Elastic IP to communicate with the internet.
Commonly used for web servers, bastion hosts, and other public-facing applications.
NAT Gateway
A NAT (Network Address Translation) Gateway enables instances in private subnets to access the internet outbound only, while preventing any inbound connections from the internet. The traffic flow is outbound only, effectively blocking unsolicited inbound traffic.
Instances private subnets use private IP addresses, and the NAT Gateway translates these to a public IP address for outbound internet access. NAT Gateways are charged on an hourly basis, along with data processing fees.
Key Features of an Internet Gateway (IGW)
Enables two-way internet connectivity (both inbound and outbound traffic).
Allows resources in a VPC to communicate directly with the public internet.
Primarily used with public subnets.
Requires instances to have a public IPv4 address or an Elastic IP.
Horizontally scaled and highly available, managed entirely by AWS.
Acts as a target in route tables for internet-bound traffic (0.0.0.0/0).
Free to use (no hourly cost; standard data transfer charges may apply).
Commonly used for web servers, bastion hosts, and public-facing applications.

Join the conversation! Your thoughts help the community grow.