Bird
Raised Fist0
AWScloud~5 mins

Health checks with Route 53 in AWS - Commands & Configuration

Choose your learning style10 modes available
Introduction
Sometimes your website or app server might stop working. Health checks help automatically watch your servers and tell Route 53 if one is down. This way, Route 53 can send users to a working server instead of a broken one.
When you want to make sure users only reach servers that are working well.
When you have multiple servers and want to send traffic away from any that fail.
When you want to get alerts if your website or app stops responding.
When you want to automatically switch to a backup server if the main one is down.
When you want to improve your website’s reliability without manual checks.
Config File - health-check.json
health-check.json
{
  "CallerReference": "unique-string-20240601",
  "HealthCheckConfig": {
    "IPAddress": "192.0.2.44",
    "Port": 80,
    "Type": "HTTP",
    "ResourcePath": "/health",
    "RequestInterval": 30,
    "FailureThreshold": 3
  }
}

This JSON file defines a Route 53 health check configuration.

  • CallerReference: A unique string to identify this health check request.
  • IPAddress: The IP address of the server to check.
  • Port: The port number to connect to (80 for HTTP).
  • Type: The protocol used for the check (HTTP here).
  • ResourcePath: The path Route 53 requests to check server health.
  • RequestInterval: How often (in seconds) Route 53 checks the server.
  • FailureThreshold: How many failed checks before marking the server unhealthy.
Commands
This command creates a health check in Route 53 using the JSON configuration file. It tells AWS which server to check and how.
Terminal
aws route53 create-health-check --cli-input-json file://health-check.json
Expected OutputExpected
{ "HealthCheck": { "Id": "abcdef12-3456-7890-abcd-ef1234567890", "CallerReference": "unique-string-20240601", "HealthCheckConfig": { "IPAddress": "192.0.2.44", "Port": 80, "Type": "HTTP", "ResourcePath": "/health", "RequestInterval": 30, "FailureThreshold": 3 }, "HealthCheckVersion": 1, "HealthCheckStatus": "Healthy" } }
→
--cli-input-json - Specifies the JSON file with health check settings
This command retrieves details about the health check we just created to confirm it exists and see its status.
Terminal
aws route53 get-health-check --health-check-id abcdef12-3456-7890-abcd-ef1234567890
Expected OutputExpected
{ "HealthCheck": { "Id": "abcdef12-3456-7890-abcd-ef1234567890", "CallerReference": "unique-string-20240601", "HealthCheckConfig": { "IPAddress": "192.0.2.44", "Port": 80, "Type": "HTTP", "ResourcePath": "/health", "RequestInterval": 30, "FailureThreshold": 3 }, "HealthCheckVersion": 1, "HealthCheckStatus": "Healthy" } }
→
--health-check-id - Specifies the ID of the health check to get details for
This command lists all health checks in your AWS account so you can see all the checks you have set up.
Terminal
aws route53 list-health-checks
Expected OutputExpected
{ "HealthChecks": [ { "Id": "abcdef12-3456-7890-abcd-ef1234567890", "CallerReference": "unique-string-20240601", "HealthCheckConfig": { "IPAddress": "192.0.2.44", "Port": 80, "Type": "HTTP", "ResourcePath": "/health" } } ] }
Key Concept

If you remember nothing else from this pattern, remember: Route 53 health checks watch your servers and help send users only to servers that are working.

Common Mistakes
Using an incorrect IP address or domain in the health check configuration.
Route 53 will check the wrong server and mark your real server as unhealthy.
Double-check the IP address or domain you enter matches the server you want to monitor.
Setting the failure threshold too low, like 1.
Temporary network glitches can cause false alarms and mark a healthy server as down.
Use a failure threshold of at least 3 to avoid false positives.
Not specifying the correct resource path for HTTP checks.
Route 53 might get a 404 error and think the server is unhealthy.
Set the resource path to a simple URL that always returns a 200 OK status, like /health.
Summary
Create a health check JSON file to tell Route 53 which server and path to check.
Use the AWS CLI to create the health check with the JSON file.
Verify the health check exists and see its status with AWS CLI commands.
List all health checks to manage multiple servers.
Health checks help Route 53 send users only to healthy servers automatically.

Practice

(1/5)
1. What is the main purpose of a health check in AWS Route 53?
easy
A. To monitor if a website or server is working properly
B. To increase the storage capacity of a server
C. To speed up the DNS resolution process
D. To encrypt data between users and servers

Solution

  1. Step 1: Understand the role of health checks

    Health checks in Route 53 monitor the status of your website or server to see if it is working correctly.
  2. Step 2: Identify the main purpose

    The main goal is to ensure traffic is sent only to healthy endpoints by checking their health status.
  3. Final Answer:

    To monitor if a website or server is working properly -> Option A
  4. Quick Check:

    Health check purpose = Monitor server health [OK]
Hint: Health checks watch if your site/server is up [OK]
Common Mistakes:
  • Confusing health checks with encryption
  • Thinking health checks speed up DNS
  • Assuming health checks add storage
2. Which of the following is the correct way to configure a Route 53 health check to check an HTTP endpoint on port 80?
easy
A. Set Protocol to FTP and Port to 21
B. Set Protocol to HTTPS and Port to 443
C. Set Protocol to TCP and Port to 22
D. Set Protocol to HTTP and Port to 80

Solution

  1. Step 1: Identify the protocol and port for HTTP

    HTTP uses protocol HTTP and port 80 by default.
  2. Step 2: Match the correct configuration

    Setting Protocol to HTTP and Port to 80 correctly configures the health check for an HTTP endpoint.
  3. Final Answer:

    Set Protocol to HTTP and Port to 80 -> Option D
  4. Quick Check:

    HTTP = Protocol HTTP + Port 80 [OK]
Hint: HTTP always uses port 80 [OK]
Common Mistakes:
  • Using HTTPS protocol for HTTP checks
  • Choosing wrong ports like 22 or 21
  • Confusing TCP with HTTP protocol
3. Given a Route 53 health check configured to check an HTTP endpoint every 30 seconds with a failure threshold of 3, how long will it take before Route 53 marks the endpoint as unhealthy after it stops responding?
medium
A. 30 seconds
B. 60 seconds
C. 90 seconds
D. 120 seconds

Solution

  1. Step 1: Understand failure threshold and interval

    The health check runs every 30 seconds and requires 3 consecutive failures to mark unhealthy.
  2. Step 2: Calculate total time to mark unhealthy

    3 failures x 30 seconds each = 90 seconds before marking unhealthy.
  3. Final Answer:

    90 seconds -> Option C
  4. Quick Check:

    3 failures x 30s = 90s [OK]
Hint: Multiply interval by failure threshold [OK]
Common Mistakes:
  • Using interval time only without threshold
  • Adding instead of multiplying
  • Confusing seconds with minutes
4. You created a Route 53 health check for an HTTPS endpoint on port 443, but Route 53 always marks it unhealthy even though the site is up. What is the most likely cause?
medium
A. The health check is set to HTTP instead of HTTPS
B. The failure threshold is set too high
C. The endpoint is using port 80 instead of 443
D. The health check is configured with TCP protocol

Solution

  1. Step 1: Check protocol mismatch

    If the health check is set to HTTP but the endpoint requires HTTPS, the check will fail.
  2. Step 2: Confirm correct protocol and port

    HTTPS requires protocol HTTPS and port 443; using HTTP protocol causes failure.
  3. Final Answer:

    The health check is set to HTTP instead of HTTPS -> Option A
  4. Quick Check:

    Protocol mismatch causes failure [OK]
Hint: Match protocol exactly with endpoint [OK]
Common Mistakes:
  • Ignoring protocol and port mismatch
  • Assuming failure threshold causes failure
  • Confusing TCP with HTTPS protocol
5. You want Route 53 to route traffic only to healthy web servers in multiple regions. You have health checks set up for each server. Which routing policy should you use to ensure traffic goes only to healthy servers and balances load across them?
hard
A. Simple routing policy
B. Weighted routing policy with health checks enabled
C. Latency routing policy without health checks
D. Failover routing policy

Solution

  1. Step 1: Understand routing policies

    Simple routing sends traffic to one resource; failover sends to primary then backup; weighted distributes traffic by weights; latency routes to lowest latency.
  2. Step 2: Choose policy that balances load and respects health

    Weighted routing with health checks enabled sends traffic only to healthy servers and balances load based on weights.
  3. Final Answer:

    Weighted routing policy with health checks enabled -> Option B
  4. Quick Check:

    Weighted + health checks = balanced healthy routing [OK]
Hint: Use weighted routing with health checks for balanced healthy traffic [OK]
Common Mistakes:
  • Using simple routing which ignores health checks
  • Failover only switches on failure, no load balance
  • Latency routing without health checks risks unhealthy targets
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard