Plan a Disaster Recovery (DR) using AWS regions

Introduction

Having a Disaster Recovery (DR) plan is a must to keep your personal or company site safe. Implementing High Availability (HA) is a good practice to ensure an alternative option in case of any failure of services, but it is not enough. HA works by placing redundant hosts running in different availability zones but in the same region.

In the event that your access to a particular region fails, a severe degradation in performance is experienced, or any other business critical issue is encountered, a DR plan allows you to recover your data from a different region regardless of the distance between the instances that are hosting your services and data.

Having a periodic DR plan based on daily or weekly backups in different regions is a best practice that you should implement now to ensure that both your IT infrastructure and sensitive data are safe under any circumstance.

This guide walks you through the process of creating an AMI from a running instance, deploying it in a different region, and associating its IP address to the new instance. It uses the Bitnami WordPress image and Asia Pacific region as examples, but these concepts are generally applicable to most applications and any publicly available region.

Assumptions and prerequisites

Step 1: Create an AMI from your running instance and copy it into a different region

The first step is to create an image using your running instance and copy it to a different region. Once it is available in the region of your choice, you can launch it in an instance as demonstrated in step 2. In our WordPress example, we use a unique theme to demonstrate that the copied AMI preserves the same configuration as the original.

IMPORTANT: Remember to perform this step every time you apply a major change to your site. That way, the duplicate site, will be kept up to speed and relevant in case of a disaster.

To create an AMI and copy it into a different region:

  • Log in to the AWS Management Console.
  • Select your instance and then select the "Create Image" option in the "Actions" menu.

    Create an AMI from an instance

  • Specify the name for the new image and then click the "Create Image" button.

    Set AMI details

  • From the "AMIs" menu in the navigation panel, select the new image and select the "Copy AMI" option in the "Actions" menu.
  • Specify the new region in the resulting dialog window and click the "Copy AMI" button.

    Copy the AMI into a different region

You will now be able to launch a new instance with the image in the new region.

Step 2: Launch an instance in a different region using the copied AMI

Once you have created the AMI and copied it into a different region from the original instance, you can launch a new instance using it. To do so:

  • In the top menu of the AWS Console, select the region where you have copied the image. In this example, we are using Asia Pacific (Tokyo).

    Change region

  • Navigate to "Images -> AMIs" and search for the recently copied AMI. Select it and click either "Launch" or "Actions -> Launch".

    Launch AMI

  • Select the Instance Type and click "Review and Launch". In the resulting screen, review the instance launch information. Check that the "AMI Details" section AMI shows the image you have copied from your instance. Click "Launch" to proceed.

    Check AMI details

    NOTE: In case you want to change the instance network configuration, click "Next: Configure Instance Details" to create a new VPC and enter the new values in the "Network" and "Subnet" fields.
  • Navigate to the "Instances -> Instances" section and select the new instance to see its description. Note the Public DNS or public IP address to later access the application:

    Check instance IP address

  • To check that the new instance contains and preserves all the information and configuration of the original instance, enter the Public DNS or public IP address in a web browser. You should see a WordPress application with the same look as the original one:

    Check new WordPress

    IMPORTANT: At this point, you must log in using the credentials for the original imported WordPress instance. Access the administration panel by browsing to http://SERVER-IP/wp-admin/.

Step 3: Create an IP address in the new region and associate it to the new instance

Since AWS doesn't allow sharing of resources accross regions, the last step is to create a new IP address in the new region and associate it to the new instance. That way, you will be able to configure a custom domain once you have configured a static IP address (also known as an "elastic IP") for the new instance. Follow these instructions:

  • Select the instance in the dashboard.
  • In the left navigation bar, select the "Network & Security -> Elastic IPs" menu item.
  • Click the "Allocate New Address" button.

AWS IP address configuration

  • Click "Allocate" in the next screen.

AWS IP address configuration

A new static IP address will be generated and will appear in the list of available IP addresses.

AWS IP address configuration

Next:

  • From the "Actions" drop-down menu, select the "Associate Address" menu item.

Associate IP address

  • In the resulting dialog box, enter the instance ID of your server and click the "Associate" button.

Associate IP address to the instance

The elastic IP address will now be assigned to your server and will persist across shutdown/reboot operations. Once you have configured the static IP address for your new instance, you can configure the domain in your DNS provider. Follow the instructions given in the "Configure the domain in your DNS provider" section in the FAQ.

NOTE: Remember that once you make the necessary changes, it can take up to 48 hours for the change to propagate across other DNS servers. You can verify the new DNS record by using the Global DNS Propagation Checker and entering your domain name into the search field.

To learn more about the topics discussed in this guide, consider visiting the following links:

aws

Bitnami Documentation