In a prior video (https://youtu.be/ZGGpEwThhrM), we saw how to create a simple application load balancer that routed traffic to a single target group. But what if you have a more complicated use case? For example, what if you need to route GET and POST requests differently? Or route differently based on the user’s browser? Or the destination path? Or something in the query string?
For that, you’ll need to work with multiple target groups, setting up listener rules to route traffic to the appropriate place.
In this hands-on tutorial, I’ll walk you through how set up a load balancer that uses two target groups. The load balancer will route traffic based on listener rules that we’ll define.
??If you’re interested in getting AWS certifications, check out these full courses. They include lots of hands-on demos, quizzes and full practice exams. Use FRIENDS10 for a 10% discount!
– AWS Certified Cloud Practitioner: https://academy.zerotomastery.io/a/aff_n20ghyn4/external?affcode=441520_lm7gzk-d
– AWS Certified Solutions Architect Associate: https://academy.zerotomastery.io/a/aff_464yrtnn/external?affcode=441520_lm7gzk-d
00:00 – Overviewing the load balancer we’ll be building together
01:49 – Explaining the setup for the EC2 Instances
02:36 – Viewing the index.html pages for the EC2 instances
03:39 – Creating two target groups through the AWS Console
05:04 – Creating the application load balancer with a default HTTP listener
08:50 – Adding load balancer listener rules to route to a second target group
10:05 – Overviewing all six listener rule condition types (host-header, path-pattern, http-header, http-request-method, query-string, source-ip), with examples
11:14 – Creating a listener rule for query-string, forwarding to a second target group
13:03 – Creating a listener rule for http-header and User-Agent, forwarding to a second target group
14:40 – Editing and deleting listener rules
15:05 – Creating a listener rule for my source-ip, returning a fixed response for 403 forbidden
16:48 – IMPORTANT! Deleting your load balancer, target groups and EC2 instances