Blog

Migrating an Expiring Amazon EC2 Free Account to a New Free Account

My site, ericfahsl.com, is hosted on the Amazon Cloud and was free until April 30, 2012.  Specifically, it was hosted using the EC2 Micro Instance free tier.  I first created my account so that I could try to experiment around with having a LAMP server in the cloud and learn a bit more about it.  It then turned into the Sammy Cam, to see what my dog was up to in the corporate apartment.

So my free tier is ending, what do I do?!  Can I migrate my web server to another free account for a year and shut off my server that I now must pay actual money for?  Yes!  Do I need to restart from scratch?  No!  It turns out that's it's pretty easy to create an AMI (Amazon Machine Image, or a snapshot of the current server) and share it with another account.  I'm hoping that no one from Amazon reads (or cares).  Here were my steps:

  1. Log in to Amazon Management Console (let's call this one account A), then go to the EC2 Bucket
  2. Select your web server instance and create an AMI:



  3. It will take some time to create the image, so let's work on setting up our second EC2 free account (let's call this account B)
  4. Log out of AWS or open a new web browser and sign up for another EC2 account
  5. Enter your credit card, confirm your info, and activate your account
  6. Log in to account B, and obtain your account number.  You can find this under Account Activity (which you can get to by clicking your name in the upper-right).
  7. The AMI is probably created by now, go back to account A and check on the status, you should see it under EC2 -> AMIs



  8. Now we need to share this AMI from account A to account B. Select the AMI and choose "Permissions"


     
  9. Enter the account number from account B (you will need to remove the dashes)
  10. Log in to account B and look in the AMIs bucket under the EC2 tab
  11. Now it's time to launch your instance in account B.  Choose your availability zone (I do the default)

    The steps below could be optional, depending on how much pre-work you have done with account B. 

  12. Set up your security groups (I add ports for HTTP, HTTPS, and SSL)


     
  13. I also like to set up an elastic IP.  In the EC2 tab, choose "Elastic IPs" and associate your instance
  14. You should now have an elastic IP address - try confirming this IP takes you to your web server and conduct a quick smoke test to ensure functionality is working as-expected
  15. Now let's set up our DNS.  I'm using Route 53 and GoDaddy for my domain name (probably not the best choice, but it works). Go to the Route 53 tab and sign up
  16. Create a hosted zone with your domain name (ericfahsl.com in my case)
  17. Next create a record set.  I added two additional record sets for ericfahsl.com and www.ericfahsl.com that conduct a simple (A) routing to an IPv4 address and fill in my elastic IP address.


     
  18. Next I go to my godaddy account and update my four nameserver addresses with what was provided to my be Route53
  19. If we're feeling adventurous, let's go back into account A and stop the existing web instance
  20. Now, let's trying going to our original domain name.  If all goes well we will see our original page!  You can also try SSH'ing into your web server

    If you don't see your new web server, make sure your elastic IP is still a valid address.  If that's still working as-expected, it could be the DNS takes some time to update.  If all-else fails, start up your original instance on account A while you continue to troubleshoot.

    Good luck!