Can I recover the public IP address or Elastic IP address associated with an Amazon EC2 instance, and how can I avoid these being changed in the future?

Last updated: 2020-11-13

I stopped and started my Amazon Elastic Compute Cloud (Amazon EC2) instance, and then the public IP address associated with the instance changed. Or, I accidentally released the Elastic IP address associated with my instance. Are IP addresses recoverable, and how can I avoid this happening in the future?

Resolution

Public IP addresses

You can't manually associate or disassociate a public IP address from your instance. An instance's public IP address changes in the following scenarios:

  • Stopped or hibernated instances receive a new public IP address when started again.
  • If an instance's associated Elastic IP address is disassociated from the instance, it receives a new public IP address.

When a public IP address is no longer associated with an instance, it returns to the public IP pool. You can't recover the same public IP address for your stopped instance.

Note: You can't convert an auto-assigned dynamic public IP address to an Elastic IP address.

Elastic IP addresses

It's a best practice to use an Elastic IP address. Elastic IP addresses are allocated to your account, instead of to the instance. You can associate your Elastic IP addresses to and from instances as needed.

If you release the Elastic IP address that was allocated to your account, you might be able to recover it. For more information, see Recovering an Elastic IP address.

All instances except EC2-Classic instances retain their associated Elastic IP addresses when stopped. AWS continues to bill for Elastic IP addresses associated with a stopped instance.

Note: Elastic IP addresses associated with EC2-Classic instances aren't recoverable.


Did this article help?


Do you need billing or technical support?