IP Addresses in AWS
Amazon Web Services (AWS) provides several types of IP addressing mechanisms for resources inside a Virtual Private Cloud (VPC). Proper understanding is crucial for designing reliable, secure, and cost-effective networking.

Types of IP Addresses
- Private IP Addresses
- Assigned to resources (e.g., EC2 instances) within a VPC subnet.
- Used for communication inside the VPC, between VPCs (via peering/TGW), and with on-premises networks.
- Non-routable on the Internet.
- Each instance has:
- Primary Private IP – mandatory, remains with the instance for its lifetime.
- Secondary Private IP(s) – optional, can be assigned/detached (e.g., for HA setups, dual-homed apps).
- Public IPv4 Addresses (Ephemeral)
- Automatically assigned to instances in public subnets (if enabled).
- Released when the instance stops/terminates.
- Useful for temporary internet-facing workloads.
- Elastic IP (EIP)
- A static, public IPv4 address allocated to your AWS account.
- Can be attached to EC2 instances, NAT gateways, or Network Interfaces (ENIs).
- Unlike ephemeral public IPs, EIPs remain allocated until you explicitly release them.
- Billing note: You pay if allocated but not in use.
- IPv6 Addresses
- AWS supports dual-stack networking (IPv4 + IPv6).
- IPv6 addresses are globally unique and internet-routable (no NAT required).
- Assigned to subnets via an IPv6 CIDR block, then to individual ENIs.
- No additional cost for IPv6 usage.
Networking with IPs
- Elastic Network Interface (ENI): The virtual NIC of an EC2, can have multiple IPv4 and IPv6 addresses.
- NAT Gateway: Uses an Elastic IP for outbound traffic from private subnets.
- Internet Gateway (IGW): Allows public IP traffic to reach the Internet.
- VPC Endpoints (Gateway/Interface): Allow private IP traffic to reach AWS services without public IPs.
Best Practices
- Use private IPs for internal traffic; avoid unnecessary EIPs.
- Prefer VPC Endpoints to reach AWS services securely without internet exposure.
- Use NAT Gateway + EIP only where outbound internet access is required.
- Plan IP ranges with non-overlapping CIDRs for hybrid/multi-VPC topologies.
- Enable IPv6 for scalability and to avoid IPv4 exhaustion.
AWS IP Address Types – Comparison Table
Type | Scope | Persistence | Internet Reachable | Typical Use Cases | Cost Implications | |
|---|---|---|---|---|---|---|
Private IPv4 | VPC only (internal) | Persistent for instance lifetime (primary); secondary assignable/detachable | ❌ No (unless via NAT/IGW) | Internal communication (EC2 ↔ EC2, EC2 ↔ RDS, hybrid connections) | No direct cost | |
Public IPv4 | Global (Ephemeral) | Released when instance stops/terminates | ✅ Yes (via IGW) | Temporary internet-facing apps, dev/test workloads | No charge, but charged for data transfer out | |
Elastic IP (EIP) | Global (Static IPv4) | Persistent until released (account-level resource) | ✅ Yes (via IGW) | Stable IPs for production servers, NAT Gateways, DNS mapping | Free when associated and used; charged if allocated but idle | |
IPv6 | Global (Public by default) | Persistent for instance lifetime (assignable to ENIs) | ✅ Yes (no NAT needed) | Modern apps, IoT, global-scale architectures, avoiding IPv4 exhaustion |
|
