Search⌘ K
AI Features

Try Out Health Checks

Explore how to use AWS CLI commands to monitor the health of your WordPress instances behind a load balancer. Learn to check target health, simulate instance failure, and understand how auto-scaling and load balancing ensure your site’s resilience.

We'll cover the following...

Let’s see if our health checks work and how we can check them. We'll use the elbv2 describe-target-health command. We just need to pass the target group ARN via the --target-group-arn parameter. So, the command would look like this:

Shell
aws elbv2 describe-target-health --target-group-arn <target-group-arn>

To get the target group ARN, we can use the describe-target-groups command again, just like we did in our last lesson. The full command, therefore, looks like this:

Shell
aws elbv2 describe-target-health \
--target-group-arn $(aws elbv2 describe-target-groups \
--names wordpress-instances \
--query 'TargetGroups[*].TargetGroupArn' \
--output text)

Run the command in the terminal below:

Terminal 1
Terminal
Loading...

The output should be similar to this:

Javascript (babel-node)
{
"TargetHealthDescriptions": [
{
"Target": {
"Id": "i-0184ea1e52d5d5029",
"Port": 80
},
"HealthCheckPort": "80",
"TargetHealth": {
"State": "healthy"
}
},
{
"Target": {
"Id": "i-07ee1bd00625b312c",
"Port": 80
},
"HealthCheckPort": "80",
"TargetHealth": {
"State": "healthy"
}
}
]
}

As we can see, both targets are healthy ( ...