What are Elastic IP addresses, and how do I use them?
Last updated: 2022-08-12
I want to have a public IP address for my EC2 instance that will persist even if my instance is stopped and restarted. How do I do that?
An Elastic IP address is a reserved public IP address that you can assign to any EC2 instance in a particular region, until you choose to release it. To allocate an Elastic IP address to your account in a particular Region, see Allocate an Elastic IP address.
When you associate an Elastic IP address with an EC2 instance, it replaces the default public IP address. If an external hostname is allocated to the instance from your launch settings, it also replaces this hostname. Otherwise, it creates one for the instance. The Elastic IP address remains in place through events that normally cause the address to change, such as stopping or restarting the instance.
Note: This description applies to most AWS accounts, which are EC2-VPC by default.