page contents

About the Post

Author Information

HOW TO: Migrate an AWS Image (AMI) to another region

When I used to work at Amazon Web Services (AWS) one of the pain points was the ability to migrate your fault tolerant strategies to another region. Amazon had these great technologies to help you fail away from trouble areas. A great overview of these strategies is in a video, that I did last year, which shows you how to create an AMI and snapshots plus move them around inside of a region. You can watch that video here.

For example, you have a recent image of your web server or you have a snapshot of an EBS volume that host a key database. You are located in a region of AWS, let’s say US-East with all of these backups and now there is an outage that is like this one from April 2011 that was called “AWS Cloud Apocalypse 2011.” There were even jokes that Skynet from Terminator had taken AWS out as seen on their forums. For more articles, you can search on your favorite search engine like this: “skynet site:forums.aws.amazon.com.”

Sometime in the past 6 months, Amazon has finally allowed this feature and it is long overdue! Here is a great whitepaper from AWS on this topic and here is the support document.

Let’s walk through the steps of creating an AMI with an EBS root volume, which most Windows instances should be now:

If the image is too small in your browser, then click on the image and you can see the full version.

  1. Create a current image of your machine, which is called an Amazon Machine image (AMI):

    Right click on your EC2 instance and then select Create Image (EBS AMI)

     

  2. Provide a name and description to help you easily identify this new image

  3. View the pending status

  4. Verify the Status

  5. Verify the status is available

Now you are ready to migrate this image to another region. Note the AMI-eee570de and go to snapshots.

Right click on your snapshot with the AMI-eee570de and select copy snapshot

Select a region (I choose US East) and then Yes, Copy

Notice the advice:

Then select the region:

Then click on snapshots for a status:

They even added a nice progress bar as well:

Completed:

Now you will need to register the snapshot as an AMI, by right clicking it and selecting Create Image from Snapshot:

Then it will give you the properties and sadly, it looks like you still can’t use Windows snapshots to create an image.  The underlying software that AWS uses will not  allow Windows volumes to be created from a snapshot, since the software assumes all volumes are Linux. However, these steps will work for Linux, I may as well show you how that will work.

Give a name  and description, then match then architecture  and if need be you can change the Kernel and Ramdisk ID to help you. Select Yes, Create when ready.

Check the status:

Now you have a new image (again this will not work for Windows machines):

Another thing to note is that there are 2 different forms of virtualization. Hardware-assisted virtualization and Paravirtualization. It seems that AWS assumes most systems will be Paravirtualization, which may be causing the issue where you can’t create an AMI from snapshot on Windows EC2 systems.

I am wondering if you could do the following:

  • Create a volume form Snapshot as /dev/sda1
  • Launch a new instance with the same parameters (Windows 2008 R2) and wait for it to load
  • Stop the new instance
  • Detach the current root volume and then attach the volume we created from snapshot

So I tried it

Then I verified the new volume existed:

Launched a new instance:

Waited for the instance to launch and then tried to login (did not bother to get the password, since I want to log in with my instance):

Then I stopped the instance and detached the root volume:

Then attached my volume that I created from my Snapshot as dev/sda1:

Now I started it and tried to RDP into my instance and damn my guess was correct:

Here you can see it with my volume:

So that is how you do it in these simple steps:

  • Create an AMI
  • Copy the snapshot to the new region
  • Create a volume form Snapshot as /dev/sda1
  • Launch a new instance with the same parameters (Windows 2008 R2) and wait for it to load
  • Stop the new instance
  • Detach the current root volume and then attach the volume we created from snapshot

 

Tags: , , , ,

12 Responses to “HOW TO: Migrate an AWS Image (AMI) to another region”

  1. Larry McPhillips #

    Scott, I’m glad to see a post on this topic as it’s been one of my favorite new AWS features. Just like you, I had been a bit worried about the prospect of whole-region outages, so I never felt satisfied with disaster-recovery strategies that were confined to just one region

    The day I was able to copy our servers to another region as “hot standbys”, I started to sleep more soundly at night.

    March 4, 2013 at 5:49 AM
  2. Scott Mattie #

    Larry, that is awesome news to hear and I am glad that I could help. I was talking to some former colleagues at AWS about it and not one of them were aware of this, so they asked me to write up this article.

    Thank you for sharing. 🙂

    March 4, 2013 at 11:21 AM
    • Tariq #

      Scott, not sure which colleagues you were talking to but I mentioned this feature to you back in December but I guess you were not paying attention. ;-P

      March 5, 2013 at 7:06 PM
      • Scott Mattie #

        Tariq,

        No, it was not you, but others you know. Question, though… Why did you not post an article like this on your blog?

        March 5, 2013 at 9:45 PM
        • Tariq #

          Because there was already an article discussing this on the official AWS blog, posted when the feature went live on December 18, 2012:
          http://aws.typepad.com/aws/2012/12/ebs-snapshot-copy.html

          March 6, 2013 at 8:30 AM
          • Scott Mattie #

            Yeah, but it does not cover what you need to do for Windows images, so you can create an image in a new region. It is not enough to just talk about copying snapshots between regions, since that part is easy and also your link clearly explains it. The topic of this article is for AMI migrations, which I show you how to do and is really needed now, especially when you look at the latest ELB outage that happened toward the end of 2012. You need to be able to move images easily between regions and copying snapshots is a great feature, but it misses the real value of moving AMI’s around. 😉

            March 6, 2013 at 9:07 AM
  3. Tariq #

    I agree. Your article does cover the topic in more depth. Thanks for helping AWS customers! 🙂
    We’ll soon have a feature that will enable AMI copy across regions so we won’t have to go through this process of detaching and attaching EBS volumes.

    March 6, 2013 at 10:04 AM
    • Larry McPhillips #

      That project sounds like *fun* for the AWS developers. Lots of gnarly stuff to keep track of; I envy whoever is working on a nice juicy project like that. Enjoy!

      March 6, 2013 at 1:03 PM
    • Scott Mattie #

      You know Tariq, I miss working with you and this is a great back and forth 🙂

      March 6, 2013 at 1:05 PM
  4. I think the admin of this web site is in fact working hard
    in support of his site, because here every data is quality based information.

    April 27, 2013 at 2:32 PM

Trackbacks/Pingbacks

  1. New AWS Feature: Copy AMI | Scott Mattie's Blog - April 3, 2013

    […] my last post, I told you about moving an existing AMI to another region by exploiting the copy snapshot feature. […]

  2. New AWS Feature: Copy AMI - SQL Server Blog - SQL Server - Telligent - April 3, 2013

    […] my last post, I told you about moving an existing AMI to another region by exploiting the copy snapshot feature. […]

Copy Protected by Chetan's WP-Copyprotect.