Skip to main content
In this lesson you’ll learn what Elastic IPs are, why they’re useful, and how to allocate, associate, and release one in AWS EC2. This demo assumes a preconfigured networking environment: a VPC, an Internet Gateway, and a public subnet. A single EC2 instance (named “My Server”) is deployed in that public subnet and initially receives a public IPv4 address from AWS.
This demo shows the difference between an ephemeral public IPv4 address (assigned from the Amazon pool) and an Elastic IP (a static address you allocate to your account). You can follow the steps in the EC2 console or automate them using the AWS CLI or SDKs. See the References section for links.

What happens to a regular public IP on stop/start?

Ephemeral public IPv4 addresses assigned by AWS are not permanent. The typical behavior for a single-ENI instance:
  • The instance keeps the same private IPv4 address across stop/start.
  • The public IPv4 address assigned from Amazon’s pool is released when the instance is stopped and a new public IPv4 address may be assigned when it is started again.
Example from this demo:
  • Initial public IP: 52.90.159.117
  • Stop the instance (Instance state → Stop).
    • After stopping, the Public IPv4 address field becomes blank.
  • Start the instance (Instance state → Start) and wait until it returns to running.
    • After restart the public IPv4 changed (in the demo it got a 3.*.*.* address).
If you rely on an IP address (users, DNS records, firewall rules), this change breaks connectivity. Elastic IPs solve this problem by providing a public IPv4 address reserved for your AWS account.

Elastic IP overview

  • Elastic IP = a static public IPv4 address you allocate to your AWS account.
  • You can associate an Elastic IP to an instance or a network interface.
  • As long as you keep the Elastic IP allocated to your account, the address remains yours and can be reassigned at will.
  • AWS may charge for Elastic IPs that are allocated but not associated with a running instance — release any addresses you don’t need.

Allocate an Elastic IP

  1. In the EC2 console, open Elastic IPs.
  2. Click Allocate Elastic IP address.
  3. Leave the default (Amazon pool of IPv4 addresses) and click Allocate.
After allocation you’ll see the new Elastic IP in the list (in this demo it was 35.173.92.86). That address is now reserved for your account.

Associate the Elastic IP with an instance

  1. Select the Elastic IP, then choose Actions → Associate Elastic IP address.
  2. Choose to associate to an Instance (or to a specific network interface).
  3. If the instance has multiple private IPs, select the private IP to associate. In this demo there is only one private IP, so select the instance and click Associate.
Once associated, the instance’s Public IPv4 address is the Elastic IP (35.173.92.86 in this demo). Make sure security groups and network ACLs allow the traffic you plan to test (for example, allow ICMP for ping or TCP/22 for SSH). Verify reachability from your local machine:
Stop and start the instance again. After the instance restarts it will retain the same public IPv4 (35.173.92.86) because the Elastic IP is associated with the instance and remains allocated to your account.

Clean up: disassociate and release

When you’re finished, disassociate the Elastic IP from the instance first:
  • Select the Elastic IP → Actions → Disassociate Elastic IP address.
Then release it back to AWS:
  • Select the Elastic IP → Actions → Release Elastic IP addresses.
If you attempt to release an Elastic IP that is still associated, AWS will prevent the release and show a message telling you to disassociate it first.

Quick comparison

Console view

A screenshot of the AWS EC2 management console showing the Elastic IPs page with a selected public IPv4 address (35.173.92.86) and the Actions menu open offering options like Associate/Release. The left sidebar shows EC2 navigation items (Instances, Images, Elastic Block Store, etc.).
Remember: You cannot release an Elastic IP while it is still associated with a resource. Disassociate it first, then release it. Also note AWS may charge for allocated Elastic IP addresses that are not associated with a running instance — release any addresses you no longer need.

References

Watch Video