📖 Scenario: You are setting up a simple web application on AWS. To distribute incoming traffic evenly, you need to create a target group that will hold your application servers.
🎯 Goal: Create an AWS target group with specific settings to prepare for load balancing your web servers.
📋 What You'll Learn
Create a target group named my-target-group
Use the protocol HTTP and port 80
Set the target type to instance
Configure the health check path to /health
💡 Why This Matters
🌍 Real World
Target groups are used in AWS to manage and route traffic to groups of servers behind a load balancer.
💼 Career
Understanding target groups is important for roles in cloud infrastructure, DevOps, and site reliability engineering.
Progress0 / 4 steps
1
Create the target group dictionary
Create a dictionary called target_group with keys 'Name', 'Protocol', and 'Port'. Set the values to 'my-target-group', 'HTTP', and 80 respectively.
AWS
Hint
Use a Python dictionary with the exact keys and values as specified.
2
Add the target type configuration
Add a key 'TargetType' to the target_group dictionary and set its value to 'instance'.
AWS
Hint
Add the new key-value pair inside the existing dictionary.
3
Add health check configuration
Add a key 'HealthCheckPath' to the target_group dictionary and set its value to '/health'.
AWS
Hint
Include the health check path in the dictionary to specify the URL path for health checks.
4
Complete the target group configuration
Add a key 'HealthCheckProtocol' to the target_group dictionary and set its value to 'HTTP' to complete the health check settings.
AWS
Hint
Set the health check protocol to HTTP to match the target group's protocol.
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
Step 1: Understand target group role
A target group groups servers (targets) to distribute incoming traffic.
Step 2: Identify key functions
It also performs health checks to ensure traffic goes only to healthy servers.
Final Answer:
To group servers for load balancing and health checks -> Option D
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
Step 1: Recall supported protocols for target groups
AWS target groups support HTTP, HTTPS, TCP, TLS, UDP, and TCP_UDP protocols.
Step 2: Identify valid protocol in options
HTTP is a valid protocol; FTP, SMTP, and SSH are not supported for target groups.
Final Answer:
aws elbv2 create-target-group --protocol HTTP -> Option A
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
Step 1: Understand health check impact
Load balancers route traffic only to targets marked healthy by health checks.
Step 2: Apply to given targets
With two healthy and one unhealthy, traffic goes only to the two healthy targets.
Final Answer:
It sends traffic only to the two healthy targets -> Option A
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
Step 1: Check common causes for no healthy targets
Targets not registered or security blocking health checks cause no healthy targets.
Step 2: Analyze options
Security group blocking health check traffic prevents health checks from succeeding, causing targets to be unhealthy.
Final Answer:
Security group blocks health check traffic -> Option B
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
Step 1: Identify routing needs
Routing based on URL path requires path-based routing rules.
Step 2: Match AWS service feature
Application Load Balancer supports path-based routing to different target groups.
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.
Final Answer:
Application Load Balancer with path-based routing rules -> Option C