Sticky Sessions(Session Affinity)
What is Sticky Session?
Sticky session, or session affinity occurs when the load balancer creates a connection between a network and a user for a direction of the session. Requests for sessions from a client in a sticky session means all requests go to the same machine that received the first request.
This works for Classic Load Balancer, Application Load Balancer and Network Load Balancer
The cookie used for stickiness has an expiration date you control. It may be two types of cookies
Application-based Cookies: These could be Custom (created by target ) or Application cookies (created by load balancer)
Duration-based Cookies: Generated by load balancer
It is commonly used to make sure the user does not lose his session data.
But enabling stickiness may bring imbalance to the load over the backend EC2 instances
You can enable stickiness features from EC2 instances' Actions -> Edit attributes tab. Then you can set the cookie from there.
Last updated