Search code examples
amazon-web-servicesaws-application-load-balancer

Aws Target group: Same target is hit every single time


I have a Load Balancer setup which has a Target group associated with it. This target group has two targets. Both are healthy.

When I tried to reach the load balancer, all the traffic is routed to the same target every single time. If I deregister one of the target(which was receiving all the traffic) then the traffic goes to the other target.

Even though the default algorithm is round robin, traffic is routed to the same target every single time.

I tried changing the algorithm and other parameters, still no luck.

Can anyone let me know why this is happening? and how to fix this?


Solution

  • When you have sticky sessions enabled in your target group, the ALB will use cookies to associate future HTTP requests with the same target in the target group.

    An HTTP user agent, such as a browser (in your case Postman) will store the cookie set by the ALB and submit them with future HTTP requests to the ALB, which will lead to the ALB forwarding the call to the same target in the target group.

    See: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html