Bird
Raised Fist0
AWScloud~15 mins

Target groups concept in AWS - Deep Dive

Choose your learning style10 modes available
Overview - Target groups concept
What is it?
A target group in AWS is a way to organize and manage a set of servers or resources that receive traffic from a load balancer. It acts like a list of destinations where requests are sent. Each target group can have rules to check if the servers are healthy and ready to handle requests. This helps distribute traffic efficiently and keep applications running smoothly.
Why it matters
Without target groups, a load balancer would not know where to send incoming traffic or how to check if servers are working properly. This could lead to some servers being overloaded while others sit idle, or users getting errors if traffic is sent to broken servers. Target groups solve this by grouping servers and monitoring their health, ensuring reliable and balanced traffic flow.
Where it fits
Before learning about target groups, you should understand what a load balancer is and how it directs traffic. After mastering target groups, you can learn about advanced load balancing features like listener rules, path-based routing, and auto scaling integration.
Mental Model
Core Idea
A target group is a named collection of servers that a load balancer sends traffic to, managing which servers get requests and checking their health.
Think of it like...
Imagine a restaurant host who directs arriving guests to different dining areas (target groups). Each area has tables (servers) that the host checks to see if they are clean and ready before seating guests there.
Load Balancer
   │
   ├─ Target Group A ── Server 1 (healthy)
   │                   Server 2 (healthy)
   ├─ Target Group B ── Server 3 (unhealthy)
   │                   Server 4 (healthy)
   └─ Target Group C ── Server 5 (healthy)
                       Server 6 (healthy)
Build-Up - 7 Steps
1
FoundationWhat is a Target Group in AWS
🤔
Concept: Introduce the basic idea of a target group as a collection of resources for load balancing.
In AWS, a target group is a way to group servers or resources like EC2 instances, IP addresses, or Lambda functions. The load balancer uses this group to know where to send incoming traffic. Each target group has a protocol and port that the load balancer uses to communicate with its targets.
Result
You understand that a target group is a named set of servers or resources that receive traffic from a load balancer.
Understanding target groups is key to managing how traffic flows to your application servers in AWS.
2
FoundationTypes of Targets in Target Groups
🤔
Concept: Explain the different kinds of resources that can be part of a target group.
Targets can be EC2 instances, IP addresses, or AWS Lambda functions. This flexibility allows you to balance traffic not just to servers but also to serverless functions or specific IPs. Each target must be reachable on the port and protocol defined in the target group.
Result
You know what kinds of resources can be grouped and how they receive traffic.
Knowing target types helps you design flexible and scalable architectures.
3
IntermediateHealth Checks in Target Groups
🤔Before reading on: do you think the load balancer sends traffic to all targets regardless of their status? Commit to your answer.
Concept: Introduce health checks that monitor if targets are ready to receive traffic.
Target groups use health checks to test if each target is healthy. The load balancer sends requests to targets on a specific path or port and expects a success response. If a target fails health checks, it is marked unhealthy and stops receiving traffic until it recovers.
Result
You understand how AWS ensures traffic only goes to healthy servers.
Knowing health checks prevents downtime by avoiding sending traffic to broken servers.
4
IntermediateListener Rules and Target Group Association
🤔Before reading on: do you think a load balancer can send traffic to multiple target groups? Commit to your answer.
Concept: Explain how listeners on load balancers use rules to forward traffic to different target groups.
A listener waits for incoming traffic on a port and protocol. It uses rules to decide which target group to send the traffic to. For example, HTTP requests to /api can go to one target group, while /images go to another. This allows routing traffic based on content.
Result
You see how target groups enable flexible traffic routing.
Understanding listener rules with target groups unlocks powerful traffic management.
5
AdvancedTarget Group Integration with Auto Scaling
🤔Before reading on: do you think auto scaling groups can automatically register targets to target groups? Commit to your answer.
Concept: Show how target groups work with auto scaling to add or remove servers automatically.
Auto Scaling Groups can register and deregister instances with target groups automatically as they scale out or in. This ensures the load balancer always knows the current set of healthy servers. Health checks from the target group also influence scaling decisions.
Result
You understand how target groups support dynamic scaling of applications.
Knowing this integration helps build resilient, self-healing systems.
6
ExpertCross-Zone Load Balancing and Target Groups
🤔Before reading on: do you think target groups distribute traffic evenly across all availability zones by default? Commit to your answer.
Concept: Explain how target groups work with cross-zone load balancing to distribute traffic evenly across zones.
By default, load balancers route traffic to targets in the same availability zone as the incoming request. With cross-zone load balancing enabled, traffic is spread evenly across all healthy targets in all zones. This improves resource utilization and fault tolerance.
Result
You grasp how cross-zone load balancing affects target group traffic distribution.
Understanding this prevents uneven load and improves application availability.
7
ExpertTarget Group Stickiness and Session Management
🤔Before reading on: do you think target groups can keep a user's session on the same server? Commit to your answer.
Concept: Introduce target group stickiness that keeps user sessions on the same target for a period.
Target groups can enable stickiness, which uses cookies or load balancer-generated tokens to keep a user's requests going to the same target. This is important for applications that store session data locally on servers. Stickiness settings control duration and behavior.
Result
You understand how target groups support session persistence.
Knowing stickiness options helps design stateful applications behind load balancers.
Under the Hood
When a load balancer receives a request, it consults its listener rules to select a target group. The target group maintains a list of registered targets and their health status. The load balancer uses health check results to avoid unhealthy targets. Traffic is then routed to one of the healthy targets based on the load balancing algorithm (round robin, least connections, etc.). Health checks run periodically by sending requests to targets and updating their status.
Why designed this way?
AWS designed target groups to separate traffic routing logic from the load balancer itself, allowing flexible grouping and health monitoring. This modular design supports multiple protocols, target types, and routing rules. Alternatives like hardcoding targets in the load balancer would be less flexible and harder to manage at scale.
┌───────────────┐
│ Load Balancer │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Listener Rule │
└──────┬────────┘
       │
       ▼
┌─────────────────────┐
│    Target Group      │
│ ┌───────┐ ┌───────┐ │
│ │Target1│ │Target2│ │
│ │(healthy) (unhealthy)│
│ └───────┘ └───────┘ │
└─────────────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Do you think a target group can only contain EC2 instances? Commit to yes or no.
Common Belief:Target groups only hold EC2 instances as targets.
Tap to reveal reality
Reality:Target groups can include EC2 instances, IP addresses, and Lambda functions.
Why it matters:Limiting targets to EC2 instances reduces flexibility and prevents using serverless or IP-based targets.
Quick: Do you think health checks guarantee zero downtime? Commit to yes or no.
Common Belief:Health checks ensure no downtime by instantly removing bad targets.
Tap to reveal reality
Reality:Health checks run periodically and have thresholds, so some unhealthy targets might still receive traffic briefly.
Why it matters:Assuming instant removal can lead to overconfidence and insufficient monitoring or fallback strategies.
Quick: Do you think enabling cross-zone load balancing always improves performance? Commit to yes or no.
Common Belief:Cross-zone load balancing always makes traffic distribution better and faster.
Tap to reveal reality
Reality:Cross-zone load balancing can increase inter-zone data transfer costs and latency in some cases.
Why it matters:Misunderstanding this can lead to unexpected costs and performance issues.
Quick: Do you think target group stickiness means the load balancer never changes the target? Commit to yes or no.
Common Belief:Stickiness locks a user permanently to one target.
Tap to reveal reality
Reality:Stickiness lasts only for a configured duration and can be broken if the target becomes unhealthy.
Why it matters:Expecting permanent stickiness can cause session loss or inconsistent behavior.
Expert Zone
1
Target groups support deregistration delay, allowing in-flight requests to complete before removing a target, preventing dropped connections.
2
Health check settings like interval, timeout, and thresholds must be tuned carefully to balance responsiveness and false positives.
3
Target groups can be shared across multiple load balancers, enabling complex traffic routing and failover scenarios.
When NOT to use
Target groups are not suitable when you need direct client-to-server connections without load balancing, such as peer-to-peer applications. In those cases, consider direct IP routing or service meshes. Also, for very simple setups with a single server, a load balancer and target group may be unnecessary overhead.
Production Patterns
In production, target groups are used with auto scaling groups to dynamically adjust capacity. They are combined with listener rules for path-based routing, blue-green deployments, and can be integrated with AWS WAF for security. Monitoring target group health metrics is standard practice to detect issues early.
Connections
Service Mesh
Builds-on
Understanding target groups helps grasp how service meshes route traffic between microservices with health checks and load balancing.
DNS Load Balancing
Alternative approach
Comparing target groups with DNS load balancing shows different ways to distribute traffic and handle failures.
Human Resource Team Management
Similar pattern
Just like a HR team assigns tasks to employees based on availability and skills, target groups assign requests to servers based on health and capacity.
Common Pitfalls
#1Registering targets without proper health check configuration
Wrong approach:Creating a target group with default health check settings that do not match the application’s actual health endpoint or protocol.
Correct approach:Configure health checks with the correct protocol, path, port, and thresholds that reflect the application’s real health status.
Root cause:Assuming default health check settings work for all applications leads to false unhealthy or healthy states.
#2Not enabling cross-zone load balancing in multi-AZ setups
Wrong approach:Leaving cross-zone load balancing disabled when targets exist in multiple availability zones.
Correct approach:Enable cross-zone load balancing to ensure even traffic distribution across all zones.
Root cause:Misunderstanding how traffic is routed by default causes uneven load and potential resource waste.
#3Using stickiness without understanding session requirements
Wrong approach:Enabling stickiness on a stateless application or without configuring cookie duration properly.
Correct approach:Use stickiness only when session persistence is needed and configure duration to match session length.
Root cause:Confusing when stickiness is beneficial leads to unnecessary complexity or session issues.
Key Takeaways
Target groups organize servers or resources so load balancers know where to send traffic and how to check server health.
Health checks in target groups prevent sending requests to broken servers, improving reliability.
Listener rules use target groups to route traffic flexibly based on request content or paths.
Target groups integrate with auto scaling to dynamically adjust the set of servers handling traffic.
Advanced features like cross-zone load balancing and stickiness help optimize traffic distribution and session management.

Practice

(1/5)
1. What is the main purpose of a target group in AWS Elastic Load Balancing?
easy
A. To create virtual private clouds
B. To store user data securely
C. To manage DNS records
D. To group servers for load balancing and health checks

Solution

  1. Step 1: Understand target group role

    A target group groups servers (targets) to distribute incoming traffic.
  2. Step 2: Identify key functions

    It also performs health checks to ensure traffic goes only to healthy servers.
  3. Final Answer:

    To group servers for load balancing and health checks -> Option D
  4. Quick Check:

    Target groups = server grouping + health checks [OK]
Hint: Target groups organize servers for load balancing [OK]
Common Mistakes:
  • Confusing target groups with security groups
  • Thinking target groups store data
  • Mixing target groups with VPC functions
2. Which of the following is the correct way to specify a target group protocol in AWS CLI?
easy
A. aws elbv2 create-target-group --protocol HTTP
B. aws elbv2 create-target-group --protocol FTP
C. aws elbv2 create-target-group --protocol SMTP
D. aws elbv2 create-target-group --protocol SSH

Solution

  1. Step 1: Recall supported protocols for target groups

    AWS target groups support HTTP, HTTPS, TCP, TLS, UDP, and TCP_UDP protocols.
  2. Step 2: Identify valid protocol in options

    HTTP is a valid protocol; FTP, SMTP, and SSH are not supported for target groups.
  3. Final Answer:

    aws elbv2 create-target-group --protocol HTTP -> Option A
  4. Quick Check:

    HTTP is valid protocol for target groups [OK]
Hint: Use HTTP or HTTPS for target group protocol [OK]
Common Mistakes:
  • Using unsupported protocols like FTP or SSH
  • Confusing target group protocol with security group rules
  • Misspelling protocol names
3. Given a target group with 3 registered targets, two healthy and one unhealthy, how will the load balancer route traffic?
medium
A. It sends traffic only to the two healthy targets
B. It sends traffic equally to all three targets
C. It sends traffic only to the unhealthy target
D. It stops sending traffic until all targets are healthy

Solution

  1. Step 1: Understand health check impact

    Load balancers route traffic only to targets marked healthy by health checks.
  2. Step 2: Apply to given targets

    With two healthy and one unhealthy, traffic goes only to the two healthy targets.
  3. Final Answer:

    It sends traffic only to the two healthy targets -> Option A
  4. Quick Check:

    Traffic routes only to healthy targets [OK]
Hint: Load balancer skips unhealthy targets [OK]
Common Mistakes:
  • Assuming traffic goes to all targets regardless of health
  • Thinking traffic stops if any target is unhealthy
  • Confusing unhealthy targets with backup targets
4. You created a target group but your load balancer shows no healthy targets. What is the most likely issue?
medium
A. Load balancer is in a different region
B. Security group blocks health check traffic
C. Targets are not registered with the target group
D. Target group protocol is set to FTP

Solution

  1. Step 1: Check common causes for no healthy targets

    Targets not registered or security blocking health checks cause no healthy targets.
  2. Step 2: Analyze options

    Security group blocking health check traffic prevents health checks from succeeding, causing targets to be unhealthy.
  3. Final Answer:

    Security group blocks health check traffic -> Option B
  4. Quick Check:

    Blocked health checks cause no healthy targets [OK]
Hint: Check security groups allow health check ports [OK]
Common Mistakes:
  • Ignoring security group rules
  • Assuming region mismatch causes health check failure
  • Using unsupported protocols like FTP
5. You want to route HTTP traffic to two different target groups based on URL path: /images/* to one group and /api/* to another. Which AWS service feature should you use?
hard
A. Elastic IP addresses assigned to each target group
B. Network Load Balancer with static IP routing
C. Application Load Balancer with path-based routing rules
D. Classic Load Balancer with SSL termination

Solution

  1. Step 1: Identify routing needs

    Routing based on URL path requires path-based routing rules.
  2. Step 2: Match AWS service feature

    Application Load Balancer supports path-based routing to different target groups.
  3. Step 3: Exclude incorrect options

    Network Load Balancer does not support path-based routing; Classic Load Balancer lacks this feature; Elastic IPs do not route traffic by path.
  4. Final Answer:

    Application Load Balancer with path-based routing rules -> Option C
  5. Quick Check:

    Path-based routing = Application Load Balancer [OK]
Hint: Use ALB for URL path routing to target groups [OK]
Common Mistakes:
  • Using Network Load Balancer for path routing
  • Confusing Classic Load Balancer features
  • Thinking Elastic IPs control routing rules
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard