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 |
---|---|---|---|
|
Required |
The name associated with the LoadBalancer. The name must be unique within the client AWS account. |
|
|
Required |
The name of the policy being created. The name must be unique within the set of policies for this LoadBalancer. |
|
|
Required |
Name of the application cookie used for stickiness. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Create a new cookie stickiness policy for an app.
To assign a policy to a load balancer, you must:
- Create a policy using either
create_app_cookie_stickiness_policy()
orcreate_lb_cookie_stickiness_policy()
. - Assign the policy to the load balancer with
set_load_balancer_policies_of_listener()
. - 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