Introduction
Organizations across various sectors rely on applications that demand exceptional availability across multiple AWS Regions to fulfill latency and business continuity needs. The Amazon Route 53 Application Recovery Controller (Route 53 ARC) enhances high availability by enabling clients to continuously assess their applications’ recovery readiness and efficiently reroute workloads during failures.
As a Solutions Architect at AWS, I’ve assisted companies in the Financial Services sector in delivering scalable internet applications, an often challenging endeavor. In this blog post, I’ll illustrate how to utilize Route 53 ARC components to enhance the availability of a multi-Region web application. For architectures focused on recovery, automation is crucial; therefore, I employ AWS CodePipeline for continuous delivery, AWS CodeBuild for continuous integration, AWS CodeDeploy for automated code deployment, and Hashicorp Terraform as the Infrastructure-as-Code (IaC) tool. I will also guide you through incrementally deploying an application to one AWS Region at a time to mitigate correlated failures. Finally, I will demonstrate how to shift traffic from an active Region to a standby Region, and revert traffic once the issue necessitating the failover is resolved. For those using AWS CloudFormation, you can explore how to deploy an application with the AWS Cloud Development Kit (CDK) and configure Route 53 ARC components in the Route 53 ARC Developer Guide.
Use Case Overview
Financial Services applications cater to hundreds of thousands of customers and handle millions of transactions daily. AWS services such as Elastic Load Balancing, EC2 Auto Scaling, and Amazon DynamoDB are ideal for these applications. Through Elastic Load Balancing with resources like Application Load Balancers and Auto Scaling groups, clients can automatically adjust application capacity based on traffic with minimal operational burden. DynamoDB global tables offer applications a robust write throughput and replicate data across AWS Regions in under one second, boasting 99.999% availability while automatically resolving conflicts via a last writer wins process.
Solution Implementation
To effectively understand how Route 53 ARC, AWS CI/CD tools, and Terraform function together, it’s best to start with a small-scale example. I will guide you through deploying a sample web application, the SignUp application, which allows users to input their contact info to be notified of a new product launch from a startup.
The SignUp application is developed in NodeJS and operates in active/standby mode across two AWS Regions, each with two Availability Zones, storing data in a DynamoDB global table located in the same Regions. Route 53 ARC’s routing controls will manage each deployment at the application layer. To execute a Regional failover, simply adjust the routing control states to cease traffic to the active Region and commence traffic to the standby Region.
Prerequisites
Before you begin, ensure you have the following set up:
- An AWS account with administrator privileges and the capability to create a new Virtual Private Cloud (VPC).
- The latest AWS Command Line Interface (CLI).
- The most recent version of Hashicorp Terraform, with your environment variables properly configured for AWS.
- The JSON file processor (jq).
- A Route 53 domain name (public or private) for creating two DNS A (type Failover) records for the application.
- The source code from the route-53-application-recovery-controller-codepipeline-with-terraform GitHub repository:
git clone https://github.com/aws-samples/route-53-application-recovery-controller-codepipeline-with-terraform.git
Once these prerequisites are completed, you can proceed.
Creating AWS Resources Across Two Regions
The first action is to use Terraform to provision the necessary AWS resources, deploy the SignUp application in two Regions, and establish the required Route 53 ARC components. Within the route-53-application-recovery-controller-codepipeline-with-terraform directory, you’ll find a shell script named create-db-app-cicd-stack.sh
that utilizes Terraform to:
- Create an Amazon S3 bucket as a source code repository for the CI/CD pipeline.
- Establish a DynamoDB global table along with supporting AWS resources to operate the application across two AWS Regions.
- Generate a CI/CD pipeline featuring an approval action for sequential deployment of the application by utilizing CodePipeline, CodeBuild, and CodeDeploy.
- Set up Route 53 ARC components for readiness checks and routing controls, Route 53 Health Checks, and Route 53 DNS records.
Adjusting DNS Variables
Prior to executing the script, update the DNS Hosted Zone and DNS Domain Name variables to reflect your Route 53 domain name values as outlined in the prerequisites. Edit the set-terraform-variables.sh
file in the route-53-application-recovery-controller-codepipeline-with-terraform folder and modify lines 10 and 11 to:
export TF_VAR_DNSHostedZone=Z0ABCDEFG9Z
export TF_VAR_DNSDomainName=gtphonehome.com
Save the file.
Execute the Script
Now, run the shell script to create the AWS resources.
- Open your terminal and navigate to the script directory:
- Execute the script and direct the output to a local file to monitor deployment progress and ensure the AWS resources were successfully created:
cd route-53-application-recovery-controller-codepipeline-with-terraform
./create-db-app-cicd-stack.sh > my_terraform_create.log 2>&1
The process may take up to 20 minutes to complete across both Regions.
Reviewing AWS Resources
After the script finishes, take a moment to examine your AWS resources. The script creates the following components in each AWS Region, prefixed with “tf-arc”:
- A VPC named
tf-arc-VPC
with a CIDR of 10.0.0.0/16, along with an internet gateway and a NAT gateway for each VPC. - Two Availability Zones, each containing a public and private subnet.
- An internet-facing Application Load Balancer.
- An Auto Scaling group comprising two Amazon EC2 Linux instances, each equipped with a profile permitting access to the DynamoDB global table. Additionally, the CodeDeploy agent is installed to facilitate AWS CodeDeploy deployments.
- Two security groups for allowing traffic from the internet to the load balancer and from the load balancer to the Auto Scaling group.
The script also sets up a DynamoDB global table called nodejs-tutorial
, with email
as its partition key and no sort key. Furthermore, it generates a CI/CD Pipeline named ARC-Pipeline
, which deploys the application.
For more insights, check out this related blog post for additional information: Chanci Turner’s Blog. If you’re interested in authoritative content on this topic, visit Chvnci’s Resource. For those seeking excellent career opportunities, consider this Learning Trainer position at Amazon.
Leave a Reply