AWS
Internet Gateway
Public IP
Cloud Computing
Networking

Public IP of AWS Internet gateway

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

An AWS Internet Gateway does not have its own public IP address that you assign or target directly. Instead, it is a managed VPC component that enables traffic between public IP addresses attached to resources in your VPC and the internet.

What an Internet Gateway actually does

An Internet Gateway, usually shortened to IGW, is attached to a VPC and used as a route target for internet-bound traffic. It is horizontally scaled and highly available, but it is not a virtual machine or appliance with a single address you can look up.

A public subnet route table typically contains a default route like this:

text
Destination: 0.0.0.0/0
Target: igw-0123456789abcdef0

That route means instances in the subnet can send internet-bound traffic through the IGW, assuming they also have appropriate public addressing and security rules.

Where the public IP really lives

The public IP belongs to the resource, not to the Internet Gateway.

For example, an EC2 instance in a public subnet may have:

  • an auto-assigned public IPv4 address
  • an Elastic IP
  • a private IP inside the VPC

The IGW simply provides the path that lets internet traffic reach that public address.

Example architecture

A typical public EC2 setup looks like this:

text
EC2 instance with public IP
-> subnet route table sends 0.0.0.0/0 to IGW
-> IGW connects the VPC to the internet

The public IP is visible on the EC2 instance or Elastic IP allocation, not on the gateway.

Contrast with NAT gateways and load balancers

This confusion often comes from mixing up Internet Gateways with other AWS networking components.

A NAT Gateway does have an Elastic IP associated with it because it is a specific managed translation endpoint used for outbound internet access from private subnets.

An Application Load Balancer or Network Load Balancer can also expose public-facing addresses or DNS names.

An Internet Gateway is different. It is a routing construct for the VPC itself, not a single-address ingress endpoint.

Minimal route example

Here is a simplified route table snippet for a public subnet:

json
1[
2  {
3    "DestinationCidrBlock": "10.0.0.0/16",
4    "GatewayId": "local"
5  },
6  {
7    "DestinationCidrBlock": "0.0.0.0/0",
8    "GatewayId": "igw-0123456789abcdef0"
9  }
10]

That route alone is not enough for internet access. The instance also needs a public IP or Elastic IP, and the security group and network ACLs must allow the relevant traffic.

How to think about inbound traffic

If a user on the internet connects to an EC2 instance's Elastic IP, AWS maps that traffic to the instance and forwards it through the Internet Gateway path. The gateway is in the path, but the destination public address is still the instance's address.

So asking for the Internet Gateway's public IP is usually the wrong mental model. The better question is: which VPC resource has the public IP I care about?

Common Pitfalls

A common mistake is expecting the IGW to behave like a firewall appliance or a single public endpoint. It is neither.

Another issue is assuming that attaching an IGW automatically gives instances internet access. Without a public IP, the correct route table, and open security rules, the instance still will not be reachable.

It is also easy to confuse IGWs with NAT Gateways. NAT Gateways own Elastic IPs; Internet Gateways do not.

Summary

  • An AWS Internet Gateway does not have its own public IP address.
  • Public IPs belong to resources such as EC2 instances, Elastic IP allocations, or public load balancers.
  • The IGW is a route target that enables internet connectivity for a VPC.
  • Internet access also requires correct route tables, public addressing, and security rules.
  • If you need a fixed public address, look at the resource or service exposed to the internet, not the IGW itself.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.