Skip to content

How do I set up weighted target groups for my Application Load Balancer?

2 minute read
1

I want to register weighted target groups for my Application Load Balancer.

Resolution

Prerequisites: Create at least two target groups. Also, create an Application Load Balancer. For Default action, select one of the target groups that you created. You can also use an existing Application Load Balancer.

To configure weighted target groups, complete the following steps:

  1. Open the Amazon Elastic Compute Cloud (Amazon EC2) console.
  2. Choose Load Balancers, and then choose your load balancer.
  3. Choose the Listeners and rules tab, and then choose the text in the Protocol:Port column.
  4. Choose the Rules tab.
  5. Under Listener rules, choose the default rule.
  6. Choose Actions, and then choose Edit rule.
  7. Under Default action, choose Add target group, and then select the target group that's not already associated with the load balancer's default action.
  8. Review the relative weights of the target groups. If needed, then update the weight to a value between 0 and 999 based on your requirements.
  9. Choose Save changes.
  10. (Optional) To keep routed requests in the target group for the duration of the session, select Turn on target group stickiness.
    Note: The default value for group-level stickiness is 1 hour. You can configure the value to last between 1 second and 7 days. After the session duration ends, the load balancer distributes requests based on the target group weights.

Important: It's not a best practice to use weighted target groups as a failover mechanism. With weighted targets, Application Load Balancer distributes traffic based on weights even if all targets in the group fail their health checks.

AWS OFFICIALUpdated 3 months ago