By using AWS re:Post, you agree to the AWS re:Post Terms of Use

How do I add multiple target groups to one Application Load Balancer using the Console

0

I am trying to migrate from using a software load balancer running on an EC2 instance to an AWS ALB (Application Load Balancer). I got quite far in replicating part of the functionality of the software, but one issue stomps me. Depending on rule conditions, different requests need to go to different target groups, because the different backend EC2 instances handle different subsets of the overall URL space. However, there is no clear way in the AWS Web Console user interface to associate a second target group with an existing load balancer or associate multiple target groups with a new load balancer. If the target group is not associated with a load balancer yet, it isn't offered in the dropdown when creating a rule action to send traffic to a target group. On the target groups screen there is a menu item named "Associate with an existing load balancer", but all it does is open the main "load balancers" page, with no way to select one to be returned to the target group editing page .

I tried searching both the web and the AWS help space, but found only discussions of other AWS services (such as Terraform, CloudFormation, APIs etc.) and some flippant answers that only said to do it from the load balancer screen (but not how).

1 Answer
2
Accepted Answer

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:

  1. Open the Amazon EC2 console and navigate to the Load Balancers section.

  2. Select your Application Load Balancer.

  3. In the "Listeners" tab, find the listener you want to modify (or create a new one if needed).

  4. Click on "View/edit rules" for that listener.

  5. 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.

  6. To add a new rule, click "Insert Rule" or "Add rule" (depending on where you want to place it in the priority order).

  7. Set up the conditions for the rule (e.g., path pattern, host header, etc.).

  8. For the action, choose "Forward to" and then select the appropriate target group from the dropdown.

  9. Repeat steps 6-8 for each additional target group you want to use, creating a new rule for each.

  10. 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

profile picture
answered 25 days ago
profile picture
EXPERT
reviewed 24 days 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 .

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions