An AWS Elastic IP is a static public IPv4 address that you allocate to your account and attach to an EC2 instance or network interface. Unlike the ordinary public IP an instance receives at launch, it does not change when you stop and start the instance, and you can move it to another instance in seconds. You need one when something outside AWS must reach your server at a fixed address, such as a DNS record, a partner firewall allow-list or a license server.
This guide assumes you can already launch and connect to an instance. It explains how Elastic IPs differ from normal public addresses, how to allocate and associate one, what it costs, and when a better option exists.
When you launch an instance in a public subnet with auto-assign public IP enabled, AWS gives it a public IPv4 address from its pool. That address belongs to the instance only while the instance is running. If you stop and start the instance, it gets a different address. A reboot keeps the address, but a stop, a hibernate or a termination does not.
An Elastic IP belongs to your account, not to the instance. It stays yours until you release it.
| Property | Auto-assigned public IP | Elastic IP |
|---|---|---|
| Stays after stop and start | No | Yes |
| Can be moved to another instance | No | Yes |
| You choose when to give it up | No | Yes (release) |
| Billed | Yes, hourly | Yes, hourly |
| Scope | Instance lifetime | Region, until released |
An Elastic IP is regional. You cannot use an address allocated in one Region in another Region.
Use one when the address itself is part of an agreement with something else:
A record points at the server and you do not want to update DNS after every restart.You usually do not need one when traffic goes through an Application Load Balancer, a Network Load Balancer or CloudFront. Clients then use the DNS name of that service, and the instances behind it can change freely. Route 53 alias records also remove the need for fixed instance addresses.
In the console, open EC2, choose Elastic IPs under Network and Security, select Allocate Elastic IP address, then pick the address and choose Associate. The same steps with the AWS CLI look like this:
The first command returns an AllocationId and the address itself. Use the allocation ID for the association. After that, aws ec2 describe-addresses shows which instance holds the address.
If the instance already has a public IP, the old auto-assigned address is released when you associate the Elastic IP, and it cannot be recovered. SSH sessions to the old address drop, so connect using the new address afterwards.
Because the address is separate from the instance, you can fail over by associating it elsewhere:
The --allow-reassociation flag lets the command take the address from the instance that currently holds it. Traffic switches to the new instance once the association completes. Existing connections to the old instance break, but new ones reach the new server. This is a simple manual failover for a single-server website.
AWS charges for every public IPv4 address, including Elastic IPs, per hour. Since February 2024 this applies even when the address is attached to a running instance. An unattached Elastic IP costs the same, so allocating addresses and forgetting them is a common source of small, steady charges. Check the current rate on the EC2 pricing page, because prices change.
By default each account can allocate five Elastic IPs per Region. You can request more through Service Quotas.
To avoid waste:
aws ec2 describe-addresses and look for entries without an AssociationId.After release, the address returns to the AWS pool and you may not get it back.
An Elastic IP does not open any ports. Reachability still depends on the security group, the network ACL and the route table of the subnet, which needs a route to an internet gateway. A frequent beginner mistake is associating an Elastic IP with an instance in a private subnet and then wondering why the address does not respond. Check those three layers first.
No. AWS bills for public IPv4 addresses by the hour, whether they are attached, idle or auto-assigned. Check the VPC pricing page for the current rate.
Yes. The address stays associated with the instance until you disassociate it, so a stop and start, or a type change, does not alter it.
No. Elastic IPs are IPv4 only. IPv6 addresses assigned to an instance in a VPC are globally unique and stay with the network interface.
Yes. You can bring your own public IPv4 range with BYOIP and allocate Elastic IPs from it, which suits cases where addresses were already allow-listed by partners.
An Elastic IP gives an EC2 instance a stable public IPv4 address that you own until you release it. Allocate it, associate it by allocation ID and remap it when you replace a server. Remember that every public IPv4 address is billed hourly, that the limit is five per Region by default, and that a load balancer or DNS name is often a better choice than a fixed address on one instance.