Health checks with Route 53 in AWS - Time & Space Complexity
When using Route 53 health checks, it is important to understand how the number of health checks affects the system's work.
We want to know how the time to perform health checks grows as we add more checks.
Analyze the time complexity of the following operation sequence.
// Create multiple Route 53 health checks
for (int i = 0; i < n; i++) {
aws route53 create-health-check --caller-reference "ref-"$i \
--health-check-config IPAddress=192.0.2.1,Port=80,Type=HTTP,ResourcePath="/"
}
This sequence creates n health checks, each monitoring a specific endpoint.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: The API call to create a health check.
- How many times: This call happens once for each health check, so n times.
As the number of health checks (n) increases, the total number of API calls grows directly with n.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 |
| 100 | 100 |
| 1000 | 1000 |
Pattern observation: The work grows in a straight line with the number of health checks added.
Time Complexity: O(n)
This means the time to create health checks grows directly in proportion to how many you create.
[X] Wrong: "Creating multiple health checks happens all at once, so time stays the same no matter how many."
[OK] Correct: Each health check requires a separate API call, so more checks mean more calls and more time.
Understanding how operations grow with input size helps you design scalable systems and explain your reasoning clearly in interviews.
"What if we batch health check creations using a bulk API? How would the time complexity change?"
Practice
Solution
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.Step 2: Identify the main purpose
The main goal is to ensure traffic is sent only to healthy endpoints by checking their health status.Final Answer:
To monitor if a website or server is working properly -> Option AQuick Check:
Health check purpose = Monitor server health [OK]
- Confusing health checks with encryption
- Thinking health checks speed up DNS
- Assuming health checks add storage
Solution
Step 1: Identify the protocol and port for HTTP
HTTP uses protocol HTTP and port 80 by default.Step 2: Match the correct configuration
Setting Protocol to HTTP and Port to 80 correctly configures the health check for an HTTP endpoint.Final Answer:
Set Protocol to HTTP and Port to 80 -> Option DQuick Check:
HTTP = Protocol HTTP + Port 80 [OK]
- Using HTTPS protocol for HTTP checks
- Choosing wrong ports like 22 or 21
- Confusing TCP with HTTP protocol
Solution
Step 1: Understand failure threshold and interval
The health check runs every 30 seconds and requires 3 consecutive failures to mark unhealthy.Step 2: Calculate total time to mark unhealthy
3 failures x 30 seconds each = 90 seconds before marking unhealthy.Final Answer:
90 seconds -> Option CQuick Check:
3 failures x 30s = 90s [OK]
- Using interval time only without threshold
- Adding instead of multiplying
- Confusing seconds with minutes
Solution
Step 1: Check protocol mismatch
If the health check is set to HTTP but the endpoint requires HTTPS, the check will fail.Step 2: Confirm correct protocol and port
HTTPS requires protocol HTTPS and port 443; using HTTP protocol causes failure.Final Answer:
The health check is set to HTTP instead of HTTPS -> Option AQuick Check:
Protocol mismatch causes failure [OK]
- Ignoring protocol and port mismatch
- Assuming failure threshold causes failure
- Confusing TCP with HTTPS protocol
Solution
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.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.Final Answer:
Weighted routing policy with health checks enabled -> Option BQuick Check:
Weighted + health checks = balanced healthy routing [OK]
- Using simple routing which ignores health checks
- Failover only switches on failure, no load balance
- Latency routing without health checks risks unhealthy targets
Ready to prove it?
Pass the test and this pattern moves unknown
