Skip to content

Resource: awsRoute53HealthCheck

Provides a Route53 health check.

Example Usage

Connectivity and HTTP Status Code Check

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.route53HealthCheck.Route53HealthCheck(this, "example", {
  failureThreshold: "5",
  fqdn: "example.com",
  port: 80,
  requestInterval: "30",
  resourcePath: "/",
  tags: {
    Name: "tf-test-health-check",
  },
  type: "HTTP",
});

Connectivity and String Matching Check

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.route53HealthCheck.Route53HealthCheck(this, "example", {
  failureThreshold: "5",
  fqdn: "example.com",
  port: 443,
  requestInterval: "30",
  resourcePath: "/",
  searchString: "example",
  type: "HTTPS_STR_MATCH",
});

Aggregate Check

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.route53HealthCheck.Route53HealthCheck(this, "parent", {
  childHealthThreshold: 1,
  childHealthchecks: ["${aws_route53_health_check.child.id}"],
  tags: {
    Name: "tf-test-calculated-health-check",
  },
  type: "CALCULATED",
});

CloudWatch Alarm Check

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCloudwatchMetricAlarmFoobar =
  new aws.cloudwatchMetricAlarm.CloudwatchMetricAlarm(this, "foobar", {
    alarmDescription: "This metric monitors ec2 cpu utilization",
    alarmName: "terraform-test-foobar5",
    comparisonOperator: "GreaterThanOrEqualToThreshold",
    evaluationPeriods: "2",
    metricName: "CPUUtilization",
    namespace: "AWS/EC2",
    period: "120",
    statistic: "Average",
    threshold: "80",
  });
new aws.route53HealthCheck.Route53HealthCheck(this, "foo", {
  cloudwatchAlarmName: awsCloudwatchMetricAlarmFoobar.alarmName,
  cloudwatchAlarmRegion: "us-west-2",
  insufficientDataHealthStatus: "Healthy",
  type: "CLOUDWATCH_METRIC",
});

Argument Reference

The following arguments are supported:

\~> Note: At least one of either fqdn or ipAddress must be specified.

  • referenceName - (Optional) This is a reference name used in Caller Reference (helpful for identifying single health_check set amongst others)
  • fqdn - (Optional) The fully qualified domain name of the endpoint to be checked.
  • ipAddress - (Optional) The IP address of the endpoint to be checked.
  • port - (Optional) The port of the endpoint to be checked.
  • type - (Required) The protocol to use when performing health checks. Valid values are http, https, HTTP_STR_MATCH, HTTPS_STR_MATCH, tcp, calculated, CLOUDWATCH_METRIC and RECOVERY_CONTROL.
  • failureThreshold - (Optional) The number of consecutive health checks that an endpoint must pass or fail.
  • requestInterval - (Required) The number of seconds between the time that Amazon Route 53 gets a response from your endpoint and the time that it sends the next health-check request.
  • resourcePath - (Optional) The path that you want Amazon Route 53 to request when performing health checks.
  • searchString - (Optional) String searched in the first 5120 bytes of the response body for check to be considered healthy. Only valid with HTTP_STR_MATCH and HTTPS_STR_MATCH.
  • measureLatency - (Optional) A Boolean value that indicates whether you want Route 53 to measure the latency between health checkers in multiple AWS regions and your endpoint and to display CloudWatch latency graphs in the Route 53 console.
  • invertHealthcheck - (Optional) A boolean value that indicates whether the status of health check should be inverted. For example, if a health check is healthy but Inverted is True , then Route 53 considers the health check to be unhealthy.
  • disabled - (Optional) A boolean value that stops Route 53 from performing health checks. When set to true, Route 53 will do the following depending on the type of health check:

    • For health checks that check the health of endpoints, Route5 53 stops submitting requests to your application, server, or other resource.
    • For calculated health checks, Route 53 stops aggregating the status of the referenced health checks.
    • For health checks that monitor CloudWatch alarms, Route 53 stops monitoring the corresponding CloudWatch metrics.

    \~> Note: After you disable a health check, Route 53 considers the status of the health check to always be healthy. If you configured DNS failover, Route 53 continues to route traffic to the corresponding resources. If you want to stop routing traffic to a resource, change the value of invertHealthcheck. * enableSni - (Optional) A boolean value that indicates whether Route53 should send the fqdn to the endpoint when performing the health check. This defaults to AWS' defaults: when the type is "HTTPS" enableSni defaults to true, when type is anything else enableSni defaults to false. * childHealthchecks - (Optional) For a specified parent health check, a list of HealthCheckId values for the associated child health checks. * childHealthThreshold - (Optional) The minimum number of child health checks that must be healthy for Route 53 to consider the parent health check to be healthy. Valid values are integers between 0 and 256, inclusive * cloudwatchAlarmName - (Optional) The name of the CloudWatch alarm. * cloudwatchAlarmRegion - (Optional) The CloudWatchRegion that the CloudWatch alarm was created in. * insufficientDataHealthStatus - (Optional) The status of the health check when CloudWatch has insufficient data about the state of associated alarm. Valid values are healthy , unhealthy and lastKnownStatus. * regions - (Optional) A list of AWS regions that you want Amazon Route 53 health checkers to check the specified endpoint from. * routingControlArn - (Optional) The Amazon Resource Name (ARN) for the Route 53 Application Recovery Controller routing control. This is used when health check type is RECOVERY_CONTROL * tags - (Optional) A map of tags to assign to the health check. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name (ARN) of the Health Check.
  • id - The id of the health check
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

Route53 Health Checks can be imported using the healthCheckId, e.g.,

$ terraform import aws_route53_health_check.http_check abcdef11-2222-3333-4444-555555fedcba