CLOUD CONCEPT

Health Checks

Health checks are automated tests that determine whether a component is functioning and suitable for receiving work.

Cloud Concepts Hub →

What is Health Checks

Health checks turn observations about infrastructure and applications into signals for traffic routing, deployment decisions, and automated recovery. Their value depends on testing the right behavior and connecting failures to appropriate actions without causing unnecessary restarts or cascading outages.

A health check evaluates a component against an explicit definition of acceptable operation. A TCP connection can establish that a port accepts connections, while an HTTP request can verify that an application responds with an expected status. A functional check might exercise a representative transaction. These checks provide different levels of confidence: a running process or successful connection does not prove that an application can serve useful requests.

Health signals should match the decision they control. A liveness check asks whether restarting a component could restore operation. A readiness check asks whether it should receive new work. A startup check allows initialization to finish before other probes enforce their normal limits. For example, an application loading a large cache might be alive but not ready. Restarting it repeatedly during initialization prevents recovery rather than helping it.

Load balancers use health checks to identify backends eligible for traffic. Engineers configure the protocol, port, request path, timeout, interval, and success criteria, along with failure and recovery thresholds. When a backend becomes unhealthy, routing can shift to healthy capacity while another controller repairs or replaces the failed component. Removing a backend from routing does not itself restart it, create replacement capacity, or preserve in-flight requests. Graceful draining, retries, and sufficient spare capacity remain necessary.

Do not assume that an unhealthy status always blocks traffic. Some load balancers deliberately fail open when every backend is unhealthy. For example, an Application Load Balancer routes to its unhealthy targets when a target group contains only unhealthy registered targets across its enabled Availability Zones. Understand the implementation's all-unhealthy behavior and maintain redundancy across failure domains rather than treating health checks as a substitute for available capacity.

Automated replacement requires an explicit connection between the health signal and the recovery controller. An EC2 instance can pass infrastructure status checks while its application fails. An Auto Scaling group must be configured to use Elastic Load Balancing health results if those failures should trigger replacement. Its health check grace period protects newly launched instances from premature health-based replacement; it does not make an unready application eligible for load-balancer traffic.

Container platforms also expose distinct failure signals. In Kubernetes, readiness failures remove Pods from normal Service traffic, while repeated liveness failures can restart containers. Startup probes defer liveness and readiness probing until startup succeeds. In Amazon ECS, inspect task-definition health checks, essential-container exits, load-balancer target health, service events, and the service health check grace period. A service repeatedly replacing tasks may be reacting correctly to a bad application build, or incorrectly to an unsuitable probe.

During deployment troubleshooting, compare failing and working versions, then verify the probe path, listening address, container port mappings, security groups, network ACLs, response codes, and initialization time. An HTTP redirect, authentication requirement, or virtual-host mismatch can fail a probe even when ordinary user requests succeed. Blue/green and rolling deployments should require new capacity to become healthy before removing old capacity. For serverless deployments, use validation invocations, synthetic requests, and error or latency alarms rather than assuming there is a conventional instance health endpoint.

Detection speed trades off against stability. Short intervals and low failure thresholds detect faults quickly but increase probe traffic and sensitivity to transient delays. Deep checks can expose broken dependencies, but making every instance fail liveness during a shared database outage can create a restart storm. Keep checks inexpensive, bound dependency calls with timeouts, and choose whether dependency failure should affect readiness, liveness, or only an alarm.

Finally, measure end-to-end recovery rather than only probe latency. Detection, routing changes, provisioning, initialization, and data recovery all contribute to the recovery time objective. Health checks do not establish the recovery point objective or guarantee data durability; replication, backups, and recovery procedures determine acceptable data loss. Correlate probe results with application logs, platform events, metrics, and recent changes before selecting a recovery action.

Key aspects of Health Checks

Effective health checks provide meaningful, stable signals that drive appropriate routing, deployment, and recovery actions without amplifying failures.

Decision-specific health signals

Separate whether a component is alive, ready for traffic, or still starting. A dependency outage might justify removing traffic without restarting an otherwise functioning process.

Meaningful probe coverage

Choose connection, protocol, or functional tests according to the failure modes that matter. A successful HTTP response should represent useful application behavior, not merely a reachable web server.

Thresholds and stabilization

Tune timeouts, intervals, and consecutive-result thresholds against measured startup and response times. Startup allowances and recovery thresholds reduce false failures and repeated transitions between healthy and unhealthy states.

Explicit recovery integration

Connect health results to routing, replacement, restart, or rollback policies deliberately. A load balancer excluding a target and an orchestrator replacing that target are separate actions.

Failure containment

Avoid expensive probes and shared-dependency checks that can simultaneously disable every replica. Maintain spare capacity and understand what the routing layer does when no healthy backend remains.

Observable recovery and deployment gates

Use health outcomes alongside logs, metrics, and platform events to diagnose failures and validate releases. Test the complete recovery path against recovery-time requirements rather than assuming fast detection guarantees fast restoration.

Cloud services for Health Checks

Elastic Load Balancing directs requests according to target health, while EC2 Auto Scaling can replace unhealthy instances when the appropriate health-check integration is enabled. ECS and EKS manage container health and lifecycle decisions, which must be coordinated with external traffic eligibility. CodeDeploy adds deployment validation and controlled traffic transitions for supported platforms. CloudWatch supplies broader metrics, alarms, and synthetic checks, including validation for serverless applications without conventional backend probes. Together, these services support detection, traffic isolation, recovery, and release validation, but their settings must align: a load-balancer failure does not automatically imply a container restart, instance replacement, or deployment rollback.

Amazon EC2 Auto Scaling image Amazon EC2 Auto Scaling

Auto Scaling replaces instances it determines are unhealthy to maintain desired capacity. Enable Elastic Load Balancing health checks when application-level target failures should trigger replacement, and configure a suitable health check grace period.

Open Amazon EC2 Auto Scaling →
AWS CodeDeploy image AWS CodeDeploy

CodeDeploy coordinates deployment validation and traffic changes for supported compute platforms. Lifecycle validation hooks, load-balancer integration where supported, and CloudWatch alarm-based stopping or rollback help prevent unhealthy revisions from becoming the active deployment.

Open AWS CodeDeploy →
Amazon CloudWatch image Amazon CloudWatch

CloudWatch provides metrics and alarms that complement individual backend health results. CloudWatch Synthetics can exercise application endpoints, while error and latency alarms can detect failures missed by shallow probes and support deployment rollback decisions.

Open Amazon CloudWatch →