AWS Route 53 Health Check

This page shows how to write Terraform and CloudFormation for Route 53 Health Check and write them securely.

aws_route53_health_check (Terraform)

The Health Check in Route 53 can be configured in Terraform with the resource name aws_route53_health_check. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

health-checks.tf#L1
resource "aws_route53_health_check" "secure_website" {
  fqdn              = "example.com"
  port              = 443
  type              = "HTTPS"
  resource_path     = "/"
  failure_threshold = "5"
AWSroute53.tf#L43
            resource "aws_route53_health_check" "www_alias_record_nat_servers_useast1a_health_check" {
              failure_threshold = "3"
              fqdn              = aws_route53_record.www_alias_record_nat_servers_useast1a.fqdn
              port              = 443
              request_interval  = "10"
              resource_path     = "/"
route53.tf#L41
resource "aws_route53_health_check" "east" {
  failure_threshold = "3"
  fqdn              = var.east_domain
  port              = 443
  request_interval  = "30"
  resource_path     = "/"
route53_health_check_test.tf#L12
resource "aws_route53_health_check" "simple" {
  failure_threshold = "5"
  fqdn              = "example.com"
  port              = 80
  request_interval  = "30"
  resource_path     = "/"

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a Route53 health check.

AWS::Route53::HealthCheck (CloudFormation)

The HealthCheck in Route53 can be configured in CloudFormation with the resource name AWS::Route53::HealthCheck. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

6-ALBs.yml#L64
      Type: "AWS::Route53::HealthCheck"
      DependsOn: ApplicationLoadBalancer1
      Properties:
        HealthCheckConfig:
          Type: "HTTP"
          FullyQualifiedDomainName:
stack-r53arc.yml#L590
    Type: AWS::Route53::HealthCheck
    DependsOn: RoutingControlCell1
    Properties:
      HealthCheckConfig:
        Type: RECOVERY_CONTROL
        RoutingControlArn: !Ref RoutingControlCell1
cf-geo-location-routing.yml#L35
      Type: AWS::Route53::HealthCheck
      Properties:
        HealthCheckConfig:
          FailureThreshold: 3
          FullyQualifiedDomainName: !Ref SiteAAliasTarget
          Port: 443
cf-geo-location-routing.yml#L35
      Type: AWS::Route53::HealthCheck
      Properties:
        HealthCheckConfig:
          FailureThreshold: 3
          FullyQualifiedDomainName: !Ref SiteAAliasTarget
          Port: 443
route53.yml#L22
    Type: "AWS::Route53::HealthCheck"
    Properties:
      HealthCheckConfig:
        Port: "443"
        Type: "HTTPS_STR_MATCH"
        SearchString: "ok"
healthcheck.json#L33
            "Type": "AWS::Route53::HealthCheck",
            "Properties":{
                "HealthCheckConfig":{
                    "FailureThreshold":{"Ref": "FailureThreshold"},
                    "FullyQualifiedDomainName" : "wf-automation-master.appspot.com",
                    "Port":{"Ref": "Port"},
Route53.json#L3
  "resourceType" : "AWS::Route53::HealthCheck",
  "properties" : [ {
    "propertyName" : "HealthCheckConfig",
    "propertyType" : "AWS::Route53::HealthCheck::HealthCheckConfig",
    "required" : true,
    "propertyHref" : "aws-properties-route53-healthcheck-healthcheckconfig.html"
cft-R53-health-cloudwatch.json#L28
      "Type" : "AWS::Route53::HealthCheck",
      "Properties" : {
        "HealthCheckConfig" : {
          "Type" : "CLOUDWATCH_METRIC",
          "AlarmIdentifier" : {
            "Name" : {
distribution.json#L164
      "Type": "AWS::Route53::HealthCheck",
      "Properties": {
        "HealthCheckConfig": {
          "FailureThreshold": 2,
          "FullyQualifiedDomainName": {"Fn::GetAtt": ["DesignerDistribution","DomainName"]},
          "Port": 443,
dualDistribution.json#L161
      "Type": "AWS::Route53::HealthCheck",
      "Properties": {
        "HealthCheckConfig": {
          "FailureThreshold": 2,
          "FullyQualifiedDomainName": {
            "Ref": "domain"

Parameters

Explanation in CloudFormation Registry

The AWS::Route53::HealthCheck resource is a Route 53 resource type that contains settings for a Route 53 health check.

For information about associating health checks with records, see HealthCheckId in ChangeResourceRecordSets. Note You can't create a health check with simple routing.

ELB Load BalancersIf you're registering EC2 instances with an Elastic Load Balancing (ELB) load balancer, do not create Amazon Route 53 health checks for the EC2 instances. When you register an EC2 instance with a load balancer, you configure settings for an ELB health check, which performs a similar function to a Route 53 health check.

Private Hosted ZonesYou can associate health checks with failover records in a private hosted zone. Note the following:+ Route 53 health checkers are outside the VPC. To check the health of an endpoint within a VPC by IP address, you must assign a public IP address to the instance in the VPC.

  • You can configure a health checker to check the health of an external resource that the instance relies on, such as a database server.

  • You can create a CloudWatch metric, associate an alarm with the metric, and then create a health check that is based on the state of the alarm. For example, you might create a CloudWatch metric that checks the status of the Amazon EC2 StatusCheckFailed metric, add an alarm to the metric, and then create a health check that is based on the state of the alarm. For information about creating CloudWatch metrics and alarms by using the CloudWatch console, see the Amazon CloudWatch User Guide.

Frequently asked questions

What is AWS Route 53 Health Check?

AWS Route 53 Health Check is a resource for Route 53 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Route 53 Health Check?

For Terraform, the wzedi/service-health-dashboard, nzebar/TerraformAWS and awsclint/dollars-demo-terraform source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the jscottcarson/Cloudformation, gerrardcowburn/sandpit and xsoloking/aws-gerrit source code examples are useful. See the CloudFormation Example section for further details.