How to synchronize sessions using Amazon Web Services (AWS)?

amazon-ec2, amazon-elb, amazon-web-services, php, session

Solution

I think what you are looking for is 'Sticky Sessions'. If I'm right about that, Amazon gives you two different options.

Load Balancer(duration-based, I recommend this one) http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/US_StickySessions.html#US_EnableStickySessionsLBCookies

And application based session stickiness http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/US_StickySessions.html#US_EnableStickySessionsAppCookies

Problem

We're using Amazon Web Services (AWS) and we have multiple web servers and a load balancer. The problem with the web servers is, that the $_SESSION is unique for each one. I'm keeping some information about the user in the $_SESSION. What is the proper way to synchronize this information? Is there any way to unite the place, where those sessions are being kept, or should I use MySQL to store this data (I don't really like the last option)?

Original source