Understanding Private and Public IPs in AWS EC2
When working with AWS networking, it's crucial to understand Public and Private IPs, how they function within networks, and when to use Elastic IPs. This article breaks down these concepts and their implications for AWS users.
1. Overview of IP Addressing
IPv4 vs. IPv6
- IPv4 (Internet Protocol version 4)
- Most commonly used.
- Consists of four numbers separated by dots (e.g.,
192.168.1.1).
- Allows for 3.7 billion unique public addresses.
- Running out of available IPs, leading to solutions like NAT (Network Address Translation).
- IPv6 (Internet Protocol version 6)
- A newer format with a much larger address space.
- Used in IoT (Internet of Things) and modern networks.
- Less commonly implemented compared to IPv4.
For AWS services, IPv4 remains dominant, though IPv6 support is available.
2. Public vs. Private IPs
Public IP
- Assigned to an EC2 instance when it launches.
- Globally unique across the internet.
- Can be used for external access (e.g., SSH, web servers).
- Changes when an instance is stopped and restarted.
Private IP
- Assigned within an AWS VPC (Virtual Private Cloud).
- Only accessible within the private network.
- Remains constant even if the instance is stopped and restarted.
- Multiple companies can use the same private IP ranges without conflicts.