Skip to content

Resource: awsLbCookieStickinessPolicy

Provides a load balancer cookie stickiness policy, which allows an ELB to control the sticky session lifetime of the browser.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsElbLb = new aws.elb.Elb(this, "lb", {
  availabilityZones: ["us-east-1a"],
  listener: [
    {
      instancePort: 8000,
      instanceProtocol: "http",
      lbPort: 80,
      lbProtocol: "http",
    },
  ],
  name: "test-lb",
});
new aws.lbCookieStickinessPolicy.LbCookieStickinessPolicy(this, "foo", {
  cookieExpirationPeriod: 600,
  lbPort: 80,
  loadBalancer: awsElbLb.id,
  name: "foo-policy",
});

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the stickiness policy.
  • loadBalancer - (Required) The load balancer to which the policy should be attached.
  • lbPort - (Required) The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
  • cookieExpirationPeriod - (Optional) The time period after which the session cookie should be considered stale, expressed in seconds.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The ID of the policy.
  • name - The name of the stickiness policy.
  • loadBalancer - The load balancer to which the policy is attached.
  • lbPort - The load balancer port to which the policy is applied.
  • cookieExpirationPeriod - The time period after which the session cookie is considered stale, expressed in seconds.