To create a new Sticky Session policy for an AWS Elastic Load Balancer (ELB).
Table of Contents
By default, AWS ELB distributes requests to Instances running your application based on the lowest load. However, you can create a Sticky Session Policy so that a request is bound to the same Instance for the length of the entire session. Sticky sessions are based on either load balancer or application generated HTTP cookies. This tutorial will step you through how to create a Sticky Session Policy for your ELB.
The following is an excerpt from the AWS ELB Developer Guide (Sept 2010), where it speaks to the Cookie Type:
"Load Balancer-Generated HTTP Cookies
The load balancer uses a special load balancer-generated cookie to track the application instance for each request. When the load balancer receives a request, it first checks to see if this cookie is present in the request. If so, the request is sent to the application instance specified in the cookie. If there is no cookie, the load balancer chooses an application instance based on the existing load balancing algorithm. A cookie is inserted into the response for binding subsequent requests from the same user to that application instance. The policy configuration defines a cookie expiry, which establishes the duration of validity for each cookie.
For more information about the policy configuration for load balancer-generated HTTP cookies, see CreateLBCookieStickinessPolicy.
Application-Generated HTTP Cookies
The load balancer uses a special cookie to associate the session with the original server that handled the request, but follows the lifetime of the application-generated cookie corresponding to the cookie name specified in the policy configuration. The load balancer only inserts a new stickiness cookie if the application response includes a new application cookie. If the application cookie is explicitly removed or expires, the session stops being sticky until a new application cookie is issued.
For more information about the policy configuration for application-generated HTTP cookies, see CreateAppCookieStickinessPolicy.
The following steps outline a basic scenario for testing ELB's in general, including Sticky Sessions. Click the hyperlinks below if you need additional information on a specific step.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.