ALB to automatically redirect traffic

0

Cx is implementing a blue-green deployment strategy using an Application Load Balancer (ALB) with three target groups (A, B, C) and weighted routing. They have enabled target group stickiness with a 1-hour duration. However, experiencing 503 errors when clients with active sessions are stuck to target groups B or C after their instances are terminated during deployment. Is there a way to configure the ALB to automatically redirect traffic when a target group becomes unavailable, rather than maintaining the stickiness that leads to errors?

profile pictureAWS
EXPERT
asked 19 days ago76 views
2 Answers
1
Accepted Answer

Even if there is no healthy target in the target group, ALB keeps forwarding to the target group due to the stickiness and this will result in 503 errors. This will persists until sticky session expires. On thing to understand here is with the ALB is that Application stickiness can detect the target failure, but it will not work with weighted routing. Stickiness takes precedence over adjusting Weight.

There is No automatic redirection feature exists and cookie must be manually reset or timeout. This is expected behavior for duration-based stickiness ALB does not have feature to reset the duration-based stickiness unless resetting the cookie manually or stickiness duration time out.

Best Practice: For blue-green deployments with ALB, carefully coordinate stickiness duration with your deployment timeline or implement application-level handling of connection failures.

profile pictureAWS
answered 19 days ago
profile pictureAWS
EXPERT
reviewed 15 days ago
0

As mentioned in previous comments, this is the default behaviour of ALB. You can, however, reduce the "sticky" time to 5 minutes instead of an hour, thus shortening the downtime.

Alternatively, you can use listener rules like path-based or header-based routing and forward traffic to the desired target groups. You will get more control over the traffic redirection in this way.

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-update-rules.html

answered 19 days ago

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