Target Groups

What is a Target Group?

Target Group is a logical grouping of EC2, IP or Lambda that receive traffic from a LBs.

  • It tells the Load Balancer where to route traffic.

Target Group Types (Based on Load Balancer)

Load Balancer TypeSupported Target Types
ALBEC2, IP, Lambda
NLBEC2, IP, ALBs
GWLBEC2, IP

Auto Scaling Group (ASG) Integration

Note

✔ If ASG is linked to a Target Group:

  • Instances launched by ASG are automatically registered/deregistered
  • ASG uses Target Group health checks to detect and replace unhealthy instances

Health Checks in Target Groups

Purpose

  • Monitors the health of targets to ensure traffic is only routed to healthy instances

Key Configurations Example

ConfigurationValueDescription
ProtocolHTTPHTTP, HTTPS, or TCP
Port8080Target port
Path/healthUsed with HTTP/HTTPS
Healthy Threshold3Successful checks to mark as healthy (default: 5)
Unhealthy Threshold2Failed checks to mark as unhealthy (default: 2)
Timeout5sWait time for a response (default: 5s)
Interval30sTime between health checks (default: 30s)
Success Codes200HTTP status codes indicating success

Interpretation

  • Load Balancer sends a GET /health request to each target every 30s
  • If it receives 3 consecutive 200 OK responses, the target is marked healthy
  • If it fails 2 times in a row, the target is marked unhealthy