A health check tests whether a website or backend is responding as expected. It can serve two different purposes: a load balancer uses checks to avoid sending requests to unhealthy targets, while an external website check can alert you when a site becomes unavailable. section 2.2.2 section 6.2
For an external website check, connect three AWS components:
- A Lambda function sends an HTTP GET request and verifies that the response contains expected text. section 6.2
- An EventBridge rule invokes the function every five minutes. section 6.2
- A CloudWatch alarm watches failed checks and sends an email notification when the website is unavailable. section 6.2
To start in the AWS Management Console, create a Lambda function from the `lambda-canary` blueprint, give it a name, and select a new role with basic Lambda permissions. Create a scheduled rule with `rate(5 minutes)`. This approach runs the check periodically without keeping a virtual machine idle between checks; Lambda is billed by invocation. section 6.2.1 section 6.0
Checking a public website
A check can request `https://cloudonaut.io` and look for `cloudonaut` in the response. A response that lacks the expected text does not pass this check, even if the request reached the site. section 6.2
For an Application Load Balancer, configure health checks on its target group instead. The target group checks registered backends periodically, and the load balancer routes requests only to healthy targets. The example configuration checks `/index.html` over HTTP every 10 seconds, allows five seconds for a response, accepts HTTP codes 200–299, and sets healthy and unhealthy thresholds. section 2.2.2 section 14.1.1
Listing 14.2 Creating a load balancer and connecting it to an Auto Scaling group B
Listener:
Type: 'AWS::ElasticLoadBalancingV2::Listener'
Properties:
DefaultActions: #1
- TargetGroupArn: !Ref TargetGroup
Type: forward
LoadBalancerArn: !Ref LoadBalancer
Port: 80 #2
Protocol: HTTP
TargetGroup:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
HealthCheckIntervalSeconds: 10 #3
HealthCheckPath: '/index.html' #4
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 3
UnhealthyThresholdCount: 2
Matcher:
HttpCode: '200-299' #5
Port: 80 #6
Protocol: HTTP
VpcId: !Ref VPC
Use the target-group listing to locate the interval, path, protocol, timeout, thresholds, and accepted HTTP codes in a CloudFormation configuration. section 14.1.1








