Post

14. Target Groups

14. Target Groups

Target Groups


Prerequisites


1. Target Groups

"aws-ec2-0"

Target Group is a core component used with Load Balancers. It defines Where incoming traffic should be sent

1
User β†’ Load Balancer β†’ Target Group β†’ EC2

A Target Group is:

  • A logical group of backend resources
  • Used by a Load Balancer to route traffic

πŸ‘‰ Targets can be:

  • EC2 instances
  • IP addresses
  • Lambda functions

Load Balancer does NOT directly send traffic to EC2. Instead, Load Balancer β†’ Target Group β†’ Targets

Without Target Group:
  • Load Balancer must manage instances directly
  • No flexibility
  • No grouping
With Target Group:
  • Logical grouping of instances
  • Easy scaling
  • Flexible routing
  • High availability
  • Fault tolerance
  • Clean architecture

1-1. Relationship with ASG

1
Auto Scaling Group β†’ Target Group β†’ Load Balancer
ASG automatically:
  • Adds instances to Target Group
  • Removes terminated instances

1-2. Routing Logic

Target Group allows:

  • Decoupling Load Balancer and EC2
  • Flexible scaling
  • Service-based routing
1
2
3
4
5
6
7
8
User
 ↓
[ Load Balancer ]
   ↓
[ Target Group ]
   β”œβ”€β”€ EC2 (Instance A)
   β”œβ”€β”€ EC2 (Instance B)
   └── EC2 (Instance C)

Load Balancer uses Target Group to:

  • Distribute traffic
  • Apply routing rules
1
2
/api β†’ Target Group A
/web β†’ Target Group B
  • Path-based routing
  • Microservices architecture
Target Types
TypeDescription
InstanceEC2 instance ID
IPPrivate IP address
LambdaServerless function

2. Components of Template

2-1. Health Check

Target Group performs health checks.

1
GET /health
Behavior
  • Healthy β†’ receives traffic
  • Unhealthy β†’ removed from routing

Only healthy instances receive traffic

3. How to create Target Groups

3-1. Search EC2

"aws-ec2-0"

3-2. Click Navigation pane β†’ β€œTarget Groups”

"aws-tar0"

3-3. Click Button β†’ β€œCreate Auto Scaling group”

"aws-tar1"

3-4. Step 1. Create target group

"aws-tar2" "aws-tar3"

"aws-tar4"

  • Components
    • Load Balancing
    • Auto Scaling Groups
This post is licensed under CC BY 4.0 by the author.