Skip to content

Latest commit

 

History

History
97 lines (73 loc) · 4.61 KB

File metadata and controls

97 lines (73 loc) · 4.61 KB

AWS Route53 Application Recovery Controller Module

Amazon Route53 Application Recovery Controller (Route 53 ARC) is a set of Route 53 features that help you build applications with high availability. Route 53 ARC can continuously monitor your application's ability to recover from failure and control recovery across multiple AWS Availability Zones, AWS Regions, and on-premises environments. This Terraform module contains both Route 53 ARC readiness and recovery-cluster resources. You can deploy only the readiness resources, or both. For more information about creating a resilience strategy with Route 53 ARC, see Running recovery-oriented applications with Amazon Route 53 Application Recovery Controller, AWS CI/CD tools, and Terraform.

Example Architecture

Example Deployment of app with R53 ARC

Usage

The primary configuration variable is cells_definition. With this variable, you specify the AWS resources per Region that you want Route 53 ARC to monitor. See examples for working examples.

Readiness resources only

The following terraform.tfvars values create a recovery group. The recovery group consists of Region cells us-east-1 and us-west-2, each with a resource set of services elasticloadbalancing, autoscaling, dynamodb, and ec2-volume and their Amazon Resource Numbers (ARNs). Readiness checks are associated with each resource set.

name = "my-asg-elb-ddb-app"

cells_definition = {
  us-east-1 = {
    elasticloadbalancing = <arn>
    autoscaling          = <arn>
    dynamodb             = <arn>
    ec2-volume           = <arn>
  }
  us-west-2 = {
    elasticloadbalancing = <arn>
    autoscaling          = <arn>
    dynamodb             = <arn>
    ec2-volume           = <arn>
  }
}

Routing control cluster resources and Route 53 alias records

To define a managed Route 53 ARC cluster for your application, add the following Terraform variables.

create_recovery_cluster = true

hosted_zone = {
  name = "mycoolapp.com."
}

The example shown configures the following:

  • A recovery cluster with a single control panel.
  • One routing control per Region.
  • Safety rules. The default is one, but you can declare more than one.
  • One Route 53 health check per routing control.
  • Route 53 alias records for each load balancer for the domain specified.

Currently, this module supports active/passive for applications across Regions. The active Region is determined by your provider block or by var.primary_cell_region. (See "Inputs", later in this document.)

Available services

The R53 Readiness service supports monitoring many services, most of which have been implemented in this module or can easily be added / extended (even without a PR!). The service keys used in var.cells_definition must match a key in var.resource_type_name in variables.tf which links to the CloudFormation resource type that is accepted by Readiness service. Example:

variable "resource_type_name" {
  type        = map(string)
  description = "list of all service types you can pass and their associated Resource Set Type."

  default = {
    apigateway  = "AWS::ApiGatewayV2::Api"
    autoscaling = "AWS::AutoScaling::AutoScalingGroup"
    cloudwatch  = "AWS::CloudWatch::Alarm"
    dynamodb    = "AWS::DynamoDB::Table"
    ec2-volume  = "AWS::EC2::Volume"
    ...
  }
}

Adding a new service

If a service does not exist in the default var.resource_type_name value you can include it without a PR. We also ask that you please do open a PR to include it in default value.

Where you set your variables, simply define a new service key with the associated CloudFormation resource type. You must include all service keys that you plan to use in that root module. In the example below new-service is a new service that the Readiness can monitor. We add it to our local deployment and then use it immediately in var.cells_definition:

resource_type_name = {
  new-service = "AWS::NewService::NewAction"
  dynamodb    = "AWS::DynamoDB::Table"
  ...
}

cells_definition = {
  <region> = {
    new-service = <arn>
  }
}