Target Groups & Health Checks
Part of the AWS Roadmap
In short
A load balancer is only as smart as its list of healthy servers. Target groups are that list, and health checks keep it honest by quietly removing anything that stops answering.
Target groups hold the instances, IP addresses or Lambda functions a load balancer sends traffic to. Health checks regularly test each target and stop routing to unhealthy ones until they recover.

Think of it like this
The school roll call
Every morning a teacher in a Mysuru school calls out each name. Students who answer get today's work. A student who misses three roll calls in a row is marked absent and not given tasks until they answer twice again. The target group is the class register and the health check is the roll call.
Watch it happen
A target going bad and coming back
1/5The ALB requests /health on each instance every 30 seconds and gets 200 back.
The big ideas
What you need to know
Target types
instance for EC2 by ID, ip for containers and on-premises servers, lambda for a function behind an ALB. Fargate tasks use ip.
Health check settings
Path, port, interval, timeout, healthy and unhealthy thresholds, and which HTTP codes count as success.
Deregistration delay
When a target is removed, the ALB lets in-flight requests finish before cutting it off. Lower it for short requests to speed up deploys.
ASG integration
Attach the target group to an Auto Scaling group and set its health check type to ELB, so failing instances are also replaced.
See it in code
Walk through the code
1aws elbv2 create-target-group \2 --name shop-web-tg \3 --protocol HTTP --port 8080 \4 --vpc-id vpc-0abc1234def567890 \5 --target-type instance \6 --health-check-path /health \7 --health-check-interval-seconds 15 \8 --health-check-timeout-seconds 5 \9 --healthy-threshold-count 2 \10 --unhealthy-threshold-count 3 \11 --matcher HttpCode=20012 13aws elbv2 describe-target-health \14 --target-group-arn arn:aws:elasticloadbalancing:ap-south-1:111122223333:targetgroup/shop-web-tg/abc \15 --query "TargetHealthDescriptions[].[Target.Id,TargetHealth.State,TargetHealth.Reason]" \16 --output table1/4A group of EC2 instances that receive traffic on port 8080.
AWS CLI v2. describe-target-health tells you not just 'unhealthy' but why, such as Target.Timeout or Target.ResponseCodeMismatch.
Save yourself the pain
Common mistakes
Oops
Health checking a path that redirects to /login, so it returns 302 and every target looks unhealthy.
Do this instead
Use a dedicated /health path that returns 200 without auth, or add 302 to the matcher on purpose.
Oops
Forgetting the instance security group must allow the health check port from the ALB.
Do this instead
Allow the app port from the ALB's security group. Otherwise both traffic and health checks time out.
Your mission
Break a target on purpose
Quick check
Every target shows unhealthy with reason Target.ResponseCodeMismatch. What's the likely cause?
Go deeper
- 1Add a /health endpoint to your app and point the target group health check to it.
- 2Stop Nginx on one instance and watch it become unhealthy in the console.
- 3Tune the healthy and unhealthy thresholds and interval and note the effect on recovery time.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.