Amazon EC2 instances can be assigned three types of IP addresses, each with distinct characteristics and uses. These types include Public IP addresses, Private IP addresses, and Elastic IP addresses. Below is a detailed explanation of each type and their specific attributes.
Public IP Address
Public IP addresses are automatically assigned to instances in public subnets. They are accessible from the internet. Public IP addresses are retained when an instance is restarted but lost when the instance is stopped. Automatically assigned in public subnets. Reassigned if the instance is stopped/started. Associated with a private IP address on the instance. Cannot be moved between instances. Private IP Address
Private IP addresses are automatically assigned to all instances, whether they are in public or private subnets. They are used for internal communication within a VPC. Retained when the instance is stopped. Used in both public and private subnets. Remains attached to the network interface if detached or reassigned to another instance. Elastic IP Address
Elastic IP addresses are static public IP addresses that can be remapped between instances. Designed for dynamic cloud computing. Retained when the instance is stopped. Limited to 5 per region by default (can request a limit increase). Charges apply when not in use. Associated with a single private IP address on the instance. Can be moved between instances and Elastic Network Adapters. Can be assigned custom tags for categorisation. Requires configuration of DNS records via a form submission. Additional IP Address Features
Secondary IP Addresses
Instances can have multiple private IP addresses. Useful for applications like hosting multiple websites on a single server or redirecting traffic for high availability (HA). Secondary IP addresses can be reassigned. Elastic IP association is maintained when reassigned. When a secondary private address is unassigned, its associated Elastic IP address is also disassociated. Bring Your Own IP (BYOIP)
Allows you to bring your own publicly routable IPv4 or IPv6 address range from your on-premises network to AWS. AWS advertises these addresses on the internet. The address range appears in your AWS account as an address pool. Not available in all regions or for all resources. You continue to own the address range. Managing IP Addresses
You can assign or remove IP addresses from EC2 instances while they are running or stopped. All IP addresses (IPv4 and IPv6) remain attached to the network interface when detached or reassigned. When you stop and start an EC2 instance, it may be moved to different underlying hardware. You can stop and start an instance to move it to a different physical host if EC2 status checks fail or if there is planned maintenance. Attributes Modifiable When Stopped: