Generates a stickiness policy with sticky session lifetimes that follow that of an application-generated cookie. This policy can be associated only with HTTP/HTTPS listeners.

This policy is similar to the policy created by CreateLBCookieStickinessPolicy, except that the lifetime of the special Elastic Load Balancing cookie follows the lifetime of the application-generated cookie specified in the policy configuration. The LoadBalancer only inserts a new stickiness cookie when 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.

An application client must receive and send two cookies: the application-generated cookie and the special Elastic Load Balancing cookie named AWSELB. This is the default behavior for many common web browsers.

Access

public

Parameters

Parameter

Type

Required

Description

$load_balancer_name

string

Required

The name associated with the LoadBalancer. The name must be unique within the client AWS account.

$policy_name

string

Required

The name of the policy being created. The name must be unique within the set of policies for this LoadBalancer.

$cookie_name

string

Required

Name of the application cookie used for stickiness.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Create a new cookie stickiness policy for an app.

To assign a policy to a load balancer, you must:

  1. Create a policy using either create_app_cookie_stickiness_policy() or create_lb_cookie_stickiness_policy().
  2. Assign the policy to the load balancer with set_load_balancer_policies_of_listener().
  3. Remove them with delete_load_balancer_policy().
$elb = new AmazonELB();

$response = $elb->create_app_cookie_stickiness_policy('my-load-balancer', 'app-cookie-policy', 'app-cookie');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/elb.class.php | Toggle source view (9 lines) | View on GitHub

public function create_app_cookie_stickiness_policy($load_balancer_name, $policy_name, $cookie_name, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['LoadBalancerName'] = $load_balancer_name;
    $opt['PolicyName'] = $policy_name;
    $opt['CookieName'] = $cookie_name;
    
    return $this->authenticate('CreateAppCookieStickinessPolicy', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback