Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Clouds > AWS > AWS FAQs > Can the public or private IP addresses change on an EC2 instance?

Can the public or private IP addresses change on an EC2 instance?

Background Information

A common topic of confusion is understanding when and why an instance's public and/or private IP addresses can change.  For example, what happens to an instance's public IP address when an instance is rebooted, stopped and restarted, or an Elastic IP is associated or disassociated with it?

 


Answer

Once an EC2 instance is launched, it's assigned a public and private IP address at boot time.  An instance's private IP address will never change during the lifetime of that instance.  However, its public IP address can change under certain circumstances. 

Note: Public and private DNS names are constructed based upon an instance's public and private IP addresses.  So, if an instance's public IP address changes, the public DNS name will also change accordingly.

What happens when you perform the following actions?
  • Reboot - When you perform a reboot, the same virtual machine instance is rebooted.  The original virtual machine instance that was provisioned to you is never returned back to Amazon.  The public IP address will not change.
  • Assign, reassign, remove an Elastic IP address - An instance can only have one public IP address at any given time.  When an instance is assigned an Elastic IP, the EIP becomes its new public IP address and its previous public IP address (if one has already been assigned to it) will be released.  For example, if you launch an instance and later assign an Elastic IP to it, the original public IP address of the instance will be replaced by the Elastic IP address.  Later, if you disassociate the Elastic IP from the instance, a new public IP address will be assigned to the instance.  The original public IP address will not be reassigned to the instance again.
  • Relaunch - When you relaunch a server, the running instance is terminated and a new instance is launched in its place.  The new instance will have new and different public and private IP addresses than its predecessor because it's a different virtual machine that's been allocated to you.
  • Stop and Restart - When you stop a server, the associated instance is actually terminated.  Therefore, when you restart the server, another virtual machine instance will be provisioned to you, so it will have new and different public and private IP addresses.

 

Things to consider

Once you understand how IP addresses and DNS names are affected when different actions are performed, you start to realize the importance of using remappable IP addresses such as Elastic IPs for front end servers in the cloud.  Elastic IPs provide a way of maintaining the same public facing IP address even when the associated virtual machine instance is changed.

You must to post a comment.
Last modified
08:23, 21 Apr 2014

Tags

ec2

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.