Assign an Elastic IP Address to an EC2 Instance

I recently installed a new Ec2 instance and setup the system for a web service. At some point, I rebooted the instance and noticed that I could not connect to the web service via the Public IP address assigned to it. Upon investigation I discovered that the public DNS address had changed hence service not accessible.

To avoid this in future, Amazon has a built in feature to allow one to associate a static DNS IP address to an Instance so in the event of instance reboot, it does not get assigned a new DNS address but rather maintains the previously assigned address.

Steps:

– When logged into your AWS account – click on EC2

ec2-ip-01

– Under Network & Security – click Elastic IPs

ec2-ip-02

– Click on ‘Allocate New Address’ (This is assuming you have no free IP address available)

ec2-ip-03

– Select EC2 on the dialog box pop up – click ‘Yes, Allocate’

ec2-ip-04

– You should be assigned a new standard EC2 IP address in the list

ec2-ip-05

– Right-click on the new address and click ‘Associate Address’

ec2-ip-06

– Care should be taken when selecting the new Instance so an existing instance IP isn’t changed – click ‘Associate’

ec2-ip-07

That’s it. Note, do not reserve an IP if not needed as this will incur costs per hour

 
comments powered by Disqus