There are more AWS SDK examples available in the AWS Doc SDK Examples
Use CreateLbCookieStickinessPolicy
with a CLI
The following code examples show how to use CreateLbCookieStickinessPolicy
.
- CLI
-
- AWS CLI
-
To generate a duration-based stickiness policy for your HTTPS load balancer
This example generates a stickiness policy with sticky session lifetimes controlled by the specified expiration period.
Command:
aws elb create-lb-cookie-stickiness-policy --load-balancer-name
my-load-balancer
--policy-namemy-duration-cookie-policy
--cookie-expiration-period60
-
For API details, see CreateLbCookieStickinessPolicy
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example creates a stickiness policy with sticky session lifetimes controlled by the specified expiration period (in seconds).
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy -CookieExpirationPeriod 60
Example 2: This example creates a stickiness policy with sticky session lifetimes controlled by the by the lifetime of the browser (user-agent).
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy
-
For API details, see CreateLbCookieStickinessPolicy in AWS Tools for PowerShell Cmdlet Reference.
-