Skip to content

Joseph-T-Gordon

A complete log of all recent projects and skills

Menu
  • About me
  • Posts/Projects
  • Resume/Certifications
Menu

Post #94 (AWS) – Sticky Session (Session Affinity)

Posted on August 4, 2023August 4, 2023 by admin

With your load balancer in AWS you may run into an issue where you need to be able to have the user consistently connect to the same application they’ve connected to previously to ensure that session data is not lost, that is where Sticky sessions come in. A sticky session allows one client to connect to the same instance consistently for a period of 1 second to 7 days. This can affect how traffic is balanced so only use it if it is needed. It uses cookies in order to ensure you connect to the same instance. You have two different types of cookies, application-based and duration based. Application-based is a good option if you already have a session cookie your application uses, you’ll simply define it on the instance as well as your expiration time and your load balancer will use it to maintain session “stickiness”. You will need to enter the name for the cookie manually for each target group while using application-based cookies. Duration-based cookies are created on load-balancer and not the application/EC2 instance and have no need to enter the cookie name as it uses the AWS default of AWSALB, you’ll simply define the expiration period directly on the load balancer.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2025 Joseph-T-Gordon | Powered by Minimalist Blog WordPress Theme