How to Host a Duplicate AWS EC2 Instance in Another Region

In an AWS environment, it can sometimes be useful to host copies of an EC2 instance in multiple regions. An organization might do this as a way of ensuring that an application performs well for users who reside in a different part of the world, or it can be used as a way of ensuring business continuity in the event that there is a disruption in the organization's primary instance.

Unfortunately, Amazon does not provide an obvious method for replicating an instance to another region (although there are a few different ways to duplicate an instance across regions). The technique that I am about to show you is arguably the easiest way to accomplish the task at hand, but there is one significant disadvantage to using this method. Once you have duplicated the instance, this method does not provide ongoing synchronization between the instance copies.

So with that said, duplicating an instance across regions involves three main steps. The first of these steps is to create an AMI from your instance. To do this, open the EC2 console, select the instance that you want to duplicate, and then choose the Image | Create Image commands from the Actions menu. When you do, the console will display the dialog box shown in Figure 1. Enter a name and an optional description for the image, and then click on the Create Image button.

The first step in the process is to create an image from your instance.
[Click on image for larger view.] Figure 1: The first step in the process is to create an image from your instance.

The second step in the process is to copy the image that you have created to another region. To do so, click on the AMIs option, found in the console's Images section on the left side of the screen. This will take you to a list of the images that you have created. You can see what this screen looks like in Figure 2, where my newly created image is displayed.

Your newly created image can be found on the console's AMI tab.
[Click on image for larger view.] Figure 2: Your newly created image can be found on the console's AMI tab.

Once you have located the image within the list of AMIs, select the image, and then choose the Copy AMI command from the Actions menu. When prompted, choose the destination region for the copy operation, as shown in Figure 3. As you can see in the figure, you also have the option of changing the image's name, description, or encryption state as a part of the copy process. When you are done, click the Copy AMI button to begin the copy process. It is worth noting that you may have to click on the current region (in the upper right corner of the console) and then choose the destination region before you will see the newly created image copy. In some cases, it is also necessary to refresh the console a few times.

Choose the region to which you wish to copy the instance.
[Click on image for larger view.] Figure 3: Choose the region to which you wish to copy the instance.
Eventually, you should see the newly created image copy show up in the destination region. If you look at Figure 4 for instance, you can see that the console is linked to a different region than it was in Figure 2, and yet my image is showing up.
The image has been duplicated to another region.
[Click on image for larger view.] Figure 4: The image has been duplicated to another region.

The third and final step in the process is to create an EC2 instance that is based on the image. To do so, simply right click on the instance and choose the Launch command from the shortcut menu. When you do, you will be taken through the same screens that you normally encounter when creating an instance, except that you won't be prompted to choose an operating system.

One more thing that is worth pointing out is that the instance creation process prompts you to select a key pair. Because the instance is being created in a new region, you won't be able to select the key pair that was used to create the instance that was used as the basis for the creation of the image that the new instance is being generated from. Even so, the new instance is an exact clone of an existing instance. This means that the password for your original instance will be valid for logging into the clone instance.

About the Author

Brien Posey is a 19-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.

Featured