- Newest
- Most votes
- Most comments
To add multiple target groups to one Application Load Balancer using the AWS Console, you need to create listener rules for your load balancer. Here's how to do it:
-
Open the Amazon EC2 console and navigate to the Load Balancers section.
-
Select your Application Load Balancer.
-
In the "Listeners" tab, find the listener you want to modify (or create a new one if needed).
-
Click on "View/edit rules" for that listener.
-
In the rules editor, you can add new rules or edit existing ones. Each rule can forward traffic to a different target group based on conditions you specify.
-
To add a new rule, click "Insert Rule" or "Add rule" (depending on where you want to place it in the priority order).
-
Set up the conditions for the rule (e.g., path pattern, host header, etc.).
-
For the action, choose "Forward to" and then select the appropriate target group from the dropdown.
-
Repeat steps 6-8 for each additional target group you want to use, creating a new rule for each.
-
Save your changes.
This way, you can associate multiple target groups with a single Application Load Balancer and route traffic to different backend instances based on the URL or other conditions you specify in the rules.
Remember that the order of rules matters, as the ALB will use the first matching rule it finds. Make sure to arrange your rules in the correct priority order.
If you don't see a target group in the dropdown when creating a rule, ensure that the target group has been created and is in the same VPC as the load balancer.
Sources
Create a target group for your Application Load Balancer - Elastic Load Balancing
Getting started with Application Load Balancers - Elastic Load Balancing
Getting started with Application Load Balancers using the AWS CLI - Elastic Load Balancing
Relevant content
- Accepted Answerasked 7 months ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
Problem was that the target group was missing from the dropdown until all browser tabs working on the load balancer were completed and closed. Once that was done (and not using the broken "Associate with an existing load balancer" menu item), the target group appeared in the drop down. However after changing a rule to use the second target group, the page listing the rules wasn't updated accordingly without a manual refresh .