Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Assign a Fixed IP to an AWS EC2 Instance

DZone's Guide to

Assign a Fixed IP to an AWS EC2 Instance

· Cloud Zone
Free Resource

MongoDB Atlas is a database as a service that makes it easy to deploy, manage, and scale MongoDB. So you can focus on innovation, not operations. Brought to you in partnership with MongoDB.

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
  • Screen Shot 2012-12-11 at 12.57.17

  • Allocate a new address
  • Screen Shot 2012-12-11 at 12.46.40

  • Associate the address with a running instance
  • Right click to associate the IP with an instance:
    Screen Shot 2012-12-11 at 12.48.44
    Pick the instance to assign this IP to:
    Screen Shot 2012-12-11 at 12.48.22

  • Note the IP being assigned to your instance
  • Screen Shot 2012-12-11 at 12.49.50

If you go to the IP address you were assigned then you see the home page of your server:
Screen Shot 2012-12-11 at 12.50.16

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:
Screen Shot 2012-12-11 at 12.54.25

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.

MongoDB Atlas is the best way to run MongoDB on AWS — highly secure by default, highly available, and fully elastic. Get started free. Brought to you in partnership with MongoDB.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}