Sticky sessions

Sticky sessions, also known as session affinity, are a load-balancing feature that forces the load balancer to forward all requests from a client to the same EC2 instance as long as the session is active. Sticky sessions are only supported by ALBs and CLBs.

In the example below, all requests from User 1 are forwarded to the first EC2 instance, requests from Users 3 and 4 to the second EC2 instance, and requests from User 2 to the third EC2 instance. This isn’t how the ELBs would normally direct our traffic. If sticky sessions aren’t enabled, ELB will simply choose any of the EC2 instances and try to balance the overall requests per instance.

Get hands-on with 1200+ tech skills courses.