Assign a Fixed IP to an AWS EC2 Instance
Join the DZone community and get the full member experience.
Join For Free
as described in my
previous
post the ip (and dns) of your running ec2 ami will change after a
reboot of that instance. of course this makes it very hard to make your
applications on that machine available for the outside world, like in
this case our wordpress blog. that is where
elastic ip
comes to the rescue. with this feature you can assign a static ip to your instance.
assign one to your application as follows:
- click on the elastic ips link in the aws console
- allocate a new address
- associate the address with a running instance
- note the ip being assigned to your instance
right click to associate the ip with an instance:
pick the instance to assign this ip to:
if you go to the ip address you were assigned then you see the home page of your server:
and the nicest thing is that if you stop and start your instance you
will receive a new public dns but your instance is still assigned to the
elastic ip address:
one important note: as long as an elastic ip address is associated with a running instance, there is no charge for it. however an address that is not associated with a running instance costs $0.01/hour. this prevents users from ‘reserving’ addresses while they are not being used.
Opinions expressed by DZone contributors are their own.
Comments