1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. LbStickinessPolicy
AWS v6.58.0 published on Wednesday, Nov 6, 2024 by Pulumi

aws.lightsail.LbStickinessPolicy

Explore with Pulumi AI

aws logo
AWS v6.58.0 published on Wednesday, Nov 6, 2024 by Pulumi

    Configures Session Stickiness for a Lightsail Load Balancer.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const test = new aws.lightsail.Lb("test", {
        name: "test-load-balancer",
        healthCheckPath: "/",
        instancePort: 80,
        tags: {
            foo: "bar",
        },
    });
    const testLbStickinessPolicy = new aws.lightsail.LbStickinessPolicy("test", {
        lbName: test.name,
        cookieDuration: 900,
        enabled: true,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    test = aws.lightsail.Lb("test",
        name="test-load-balancer",
        health_check_path="/",
        instance_port=80,
        tags={
            "foo": "bar",
        })
    test_lb_stickiness_policy = aws.lightsail.LbStickinessPolicy("test",
        lb_name=test.name,
        cookie_duration=900,
        enabled=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := lightsail.NewLb(ctx, "test", &lightsail.LbArgs{
    			Name:            pulumi.String("test-load-balancer"),
    			HealthCheckPath: pulumi.String("/"),
    			InstancePort:    pulumi.Int(80),
    			Tags: pulumi.StringMap{
    				"foo": pulumi.String("bar"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = lightsail.NewLbStickinessPolicy(ctx, "test", &lightsail.LbStickinessPolicyArgs{
    			LbName:         test.Name,
    			CookieDuration: pulumi.Int(900),
    			Enabled:        pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Aws.LightSail.Lb("test", new()
        {
            Name = "test-load-balancer",
            HealthCheckPath = "/",
            InstancePort = 80,
            Tags = 
            {
                { "foo", "bar" },
            },
        });
    
        var testLbStickinessPolicy = new Aws.LightSail.LbStickinessPolicy("test", new()
        {
            LbName = test.Name,
            CookieDuration = 900,
            Enabled = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lightsail.Lb;
    import com.pulumi.aws.lightsail.LbArgs;
    import com.pulumi.aws.lightsail.LbStickinessPolicy;
    import com.pulumi.aws.lightsail.LbStickinessPolicyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var test = new Lb("test", LbArgs.builder()
                .name("test-load-balancer")
                .healthCheckPath("/")
                .instancePort("80")
                .tags(Map.of("foo", "bar"))
                .build());
    
            var testLbStickinessPolicy = new LbStickinessPolicy("testLbStickinessPolicy", LbStickinessPolicyArgs.builder()
                .lbName(test.name())
                .cookieDuration(900)
                .enabled(true)
                .build());
    
        }
    }
    
    resources:
      test:
        type: aws:lightsail:Lb
        properties:
          name: test-load-balancer
          healthCheckPath: /
          instancePort: '80'
          tags:
            foo: bar
      testLbStickinessPolicy:
        type: aws:lightsail:LbStickinessPolicy
        name: test
        properties:
          lbName: ${test.name}
          cookieDuration: 900
          enabled: true
    

    Create LbStickinessPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new LbStickinessPolicy(name: string, args: LbStickinessPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def LbStickinessPolicy(resource_name: str,
                           args: LbStickinessPolicyArgs,
                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def LbStickinessPolicy(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           cookie_duration: Optional[int] = None,
                           enabled: Optional[bool] = None,
                           lb_name: Optional[str] = None)
    func NewLbStickinessPolicy(ctx *Context, name string, args LbStickinessPolicyArgs, opts ...ResourceOption) (*LbStickinessPolicy, error)
    public LbStickinessPolicy(string name, LbStickinessPolicyArgs args, CustomResourceOptions? opts = null)
    public LbStickinessPolicy(String name, LbStickinessPolicyArgs args)
    public LbStickinessPolicy(String name, LbStickinessPolicyArgs args, CustomResourceOptions options)
    
    type: aws:lightsail:LbStickinessPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args LbStickinessPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args LbStickinessPolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args LbStickinessPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LbStickinessPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LbStickinessPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var lbStickinessPolicyResource = new Aws.LightSail.LbStickinessPolicy("lbStickinessPolicyResource", new()
    {
        CookieDuration = 0,
        Enabled = false,
        LbName = "string",
    });
    
    example, err := lightsail.NewLbStickinessPolicy(ctx, "lbStickinessPolicyResource", &lightsail.LbStickinessPolicyArgs{
    	CookieDuration: pulumi.Int(0),
    	Enabled:        pulumi.Bool(false),
    	LbName:         pulumi.String("string"),
    })
    
    var lbStickinessPolicyResource = new LbStickinessPolicy("lbStickinessPolicyResource", LbStickinessPolicyArgs.builder()
        .cookieDuration(0)
        .enabled(false)
        .lbName("string")
        .build());
    
    lb_stickiness_policy_resource = aws.lightsail.LbStickinessPolicy("lbStickinessPolicyResource",
        cookie_duration=0,
        enabled=False,
        lb_name="string")
    
    const lbStickinessPolicyResource = new aws.lightsail.LbStickinessPolicy("lbStickinessPolicyResource", {
        cookieDuration: 0,
        enabled: false,
        lbName: "string",
    });
    
    type: aws:lightsail:LbStickinessPolicy
    properties:
        cookieDuration: 0
        enabled: false
        lbName: string
    

    LbStickinessPolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The LbStickinessPolicy resource accepts the following input properties:

    CookieDuration int
    The cookie duration in seconds. This determines the length of the session stickiness.
    Enabled bool
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    LbName string
    The name of the load balancer to which you want to enable session stickiness.
    CookieDuration int
    The cookie duration in seconds. This determines the length of the session stickiness.
    Enabled bool
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    LbName string
    The name of the load balancer to which you want to enable session stickiness.
    cookieDuration Integer
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled Boolean
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lbName String
    The name of the load balancer to which you want to enable session stickiness.
    cookieDuration number
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled boolean
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lbName string
    The name of the load balancer to which you want to enable session stickiness.
    cookie_duration int
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled bool
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lb_name str
    The name of the load balancer to which you want to enable session stickiness.
    cookieDuration Number
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled Boolean
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lbName String
    The name of the load balancer to which you want to enable session stickiness.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the LbStickinessPolicy resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing LbStickinessPolicy Resource

    Get an existing LbStickinessPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: LbStickinessPolicyState, opts?: CustomResourceOptions): LbStickinessPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cookie_duration: Optional[int] = None,
            enabled: Optional[bool] = None,
            lb_name: Optional[str] = None) -> LbStickinessPolicy
    func GetLbStickinessPolicy(ctx *Context, name string, id IDInput, state *LbStickinessPolicyState, opts ...ResourceOption) (*LbStickinessPolicy, error)
    public static LbStickinessPolicy Get(string name, Input<string> id, LbStickinessPolicyState? state, CustomResourceOptions? opts = null)
    public static LbStickinessPolicy get(String name, Output<String> id, LbStickinessPolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CookieDuration int
    The cookie duration in seconds. This determines the length of the session stickiness.
    Enabled bool
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    LbName string
    The name of the load balancer to which you want to enable session stickiness.
    CookieDuration int
    The cookie duration in seconds. This determines the length of the session stickiness.
    Enabled bool
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    LbName string
    The name of the load balancer to which you want to enable session stickiness.
    cookieDuration Integer
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled Boolean
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lbName String
    The name of the load balancer to which you want to enable session stickiness.
    cookieDuration number
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled boolean
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lbName string
    The name of the load balancer to which you want to enable session stickiness.
    cookie_duration int
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled bool
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lb_name str
    The name of the load balancer to which you want to enable session stickiness.
    cookieDuration Number
    The cookie duration in seconds. This determines the length of the session stickiness.
    enabled Boolean
    The Session Stickiness state of the load balancer. true to activate session stickiness or false to deactivate session stickiness.
    lbName String
    The name of the load balancer to which you want to enable session stickiness.

    Import

    Using pulumi import, import aws_lightsail_lb_stickiness_policy using the lb_name attribute. For example:

    $ pulumi import aws:lightsail/lbStickinessPolicy:LbStickinessPolicy test example-load-balancer
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.58.0 published on Wednesday, Nov 6, 2024 by Pulumi