A new way to analyze data in the cloud

February 26, 2013 at 12:30am
David Crawford


Subscribe to get updates about MetricaDB

Use Elastic IPs on EC2 from the Start

In the three months we’ve been using EC2, two of our boxes have been “retired.”  It sounds as if this is happening more frequently, according to a blog post by awe.sm.  And while Amazon tries to make it as painless as possible, if you’re not using elastic IPs, you can get yourself in trouble.

When there are problems with a physical machine, Amazon may retire it, and you will need to move your image to another machine.  They’ll give you anywhere between a few days and a few weeks of notice—you’ll get an email, and a clock icon will show up next to the instance name signaling a “scheduled event.”  If you do nothing, your instance will be stopped on the scheduled day with no further notice (you only get one email, so don’t ignore it).

You can restart the instance any time after the retirement is scheduled, and your image will be automatically loaded on a new machine on startup.  This is convenient enough.  However, your machine will also be assigned new IP addresses and domain names.  And this is why you want to be using elastic IPs from the start.  A new domain name could mean updating your DNS settings, or even updating configuration and restarting other servers that connect to the affected one.

An alternative to elastic IPs would be to use only your own domain names in configuration (such as database server connection strings).  Then, when a box is retired, you can update DNS in order to avoid changing configuration, but you’ll still have downtime up to the TTL on your DNS settings.  With elastic IP settings, you can simply re-assign the IP and public domain (e.g. ec2-12-34-56-78.compute-1.amazonaws.com) to the new machine, and the changes take place immediately.