Assign an Elastic IP to EC2 instance

Background:

Amazon EC2 instance assigned with a public and private ip address. The public ip address changes when the instance stopped and started again but not when the instance restarted. Due to this nature service is prone to interruption if the instance stopped for maintenance and started again.

Workaround:

Amazon offers the Elastic IP for instances which will not change in the above scenario and helps ensure the configurations of your servers and services you are providing. To enable and assign Elastic IP to an instance go through the following.

  1. Go to the Elastic IPs under Network & Security section.  Select Allocate New Address from top.                                       
  2. Allocate New Address window will open, select Allocate.                                                                                                    
  3. Showing you the message of successful allocation of Elastic IP.                                                                       
  4. Now choose the Elastic IP allocated just now. From top select Actions > Associate address.                                                       
  5. Now select the instance from the drop down list and click the Associate button.                                                                    
  6. Successful association will shown to you.                                                                                                              
  7. Go to the Instances, select the instance and see the Elastic IP and the IPV4 Public IP has changed and are same. Also the Public DNS changed accordingly.
  8. You are done!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.