Skip to content

Resource: awsLightsailLbStickinessPolicy

Configures Session Stickiness for a Lightsail Load Balancer.

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 awsLightsailLbTest = new aws.lightsailLb.LightsailLb(this, "test", {
  healthCheckPath: "/",
  instancePort: "80",
  name: "test-load-balancer",
  tags: {
    foo: "bar",
  },
});
const awsLightsailLbStickinessPolicyTest =
  new aws.lightsailLbStickinessPolicy.LightsailLbStickinessPolicy(
    this,
    "test_1",
    {
      cookieDuration: 900,
      enabled: true,
      lbName: awsLightsailLbTest.name,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsLightsailLbStickinessPolicyTest.overrideLogicalId("test");

Argument Reference

The following arguments are supported:

  • lbName - (Required) The name of the load balancer to which you want to enable session stickiness.
  • cookieDuration - (Required) The cookie duration in seconds. This determines the length of the session stickiness.
  • enabled - (Required) - The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.

Attributes Reference

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

  • id - The name used for this load balancer (matches lbName).

Import

awsLightsailLbStickinessPolicy can be imported by using the lbName attribute, e.g.,

$ terraform import aws_lightsail_lb_stickiness_policy.test example-load-balancer