1. Packages
  2. AWS Classic
  3. API Docs
  4. elb
  5. LoadBalancerCookieStickinessPolicy

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.44.0 published on Monday, Jul 8, 2024 by Pulumi

aws.elb.LoadBalancerCookieStickinessPolicy

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.44.0 published on Monday, Jul 8, 2024 by Pulumi

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const lb = new aws.elb.LoadBalancer("lb", {
        name: "test-lb",
        availabilityZones: ["us-east-1a"],
        listeners: [{
            instancePort: 8000,
            instanceProtocol: "http",
            lbPort: 80,
            lbProtocol: "http",
        }],
    });
    const foo = new aws.elb.LoadBalancerCookieStickinessPolicy("foo", {
        name: "foo-policy",
        loadBalancer: lb.id,
        lbPort: 80,
        cookieExpirationPeriod: 600,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    lb = aws.elb.LoadBalancer("lb",
        name="test-lb",
        availability_zones=["us-east-1a"],
        listeners=[{
            "instancePort": 8000,
            "instanceProtocol": "http",
            "lbPort": 80,
            "lbProtocol": "http",
        }])
    foo = aws.elb.LoadBalancerCookieStickinessPolicy("foo",
        name="foo-policy",
        load_balancer=lb.id,
        lb_port=80,
        cookie_expiration_period=600)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		lb, err := elb.NewLoadBalancer(ctx, "lb", &elb.LoadBalancerArgs{
    			Name: pulumi.String("test-lb"),
    			AvailabilityZones: pulumi.StringArray{
    				pulumi.String("us-east-1a"),
    			},
    			Listeners: elb.LoadBalancerListenerArray{
    				&elb.LoadBalancerListenerArgs{
    					InstancePort:     pulumi.Int(8000),
    					InstanceProtocol: pulumi.String("http"),
    					LbPort:           pulumi.Int(80),
    					LbProtocol:       pulumi.String("http"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = elb.NewLoadBalancerCookieStickinessPolicy(ctx, "foo", &elb.LoadBalancerCookieStickinessPolicyArgs{
    			Name:                   pulumi.String("foo-policy"),
    			LoadBalancer:           lb.ID(),
    			LbPort:                 pulumi.Int(80),
    			CookieExpirationPeriod: pulumi.Int(600),
    		})
    		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 lb = new Aws.Elb.LoadBalancer("lb", new()
        {
            Name = "test-lb",
            AvailabilityZones = new[]
            {
                "us-east-1a",
            },
            Listeners = new[]
            {
                new Aws.Elb.Inputs.LoadBalancerListenerArgs
                {
                    InstancePort = 8000,
                    InstanceProtocol = "http",
                    LbPort = 80,
                    LbProtocol = "http",
                },
            },
        });
    
        var foo = new Aws.Elb.LoadBalancerCookieStickinessPolicy("foo", new()
        {
            Name = "foo-policy",
            LoadBalancer = lb.Id,
            LbPort = 80,
            CookieExpirationPeriod = 600,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.elb.LoadBalancer;
    import com.pulumi.aws.elb.LoadBalancerArgs;
    import com.pulumi.aws.elb.inputs.LoadBalancerListenerArgs;
    import com.pulumi.aws.elb.LoadBalancerCookieStickinessPolicy;
    import com.pulumi.aws.elb.LoadBalancerCookieStickinessPolicyArgs;
    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 lb = new LoadBalancer("lb", LoadBalancerArgs.builder()
                .name("test-lb")
                .availabilityZones("us-east-1a")
                .listeners(LoadBalancerListenerArgs.builder()
                    .instancePort(8000)
                    .instanceProtocol("http")
                    .lbPort(80)
                    .lbProtocol("http")
                    .build())
                .build());
    
            var foo = new LoadBalancerCookieStickinessPolicy("foo", LoadBalancerCookieStickinessPolicyArgs.builder()
                .name("foo-policy")
                .loadBalancer(lb.id())
                .lbPort(80)
                .cookieExpirationPeriod(600)
                .build());
    
        }
    }
    
    resources:
      lb:
        type: aws:elb:LoadBalancer
        properties:
          name: test-lb
          availabilityZones:
            - us-east-1a
          listeners:
            - instancePort: 8000
              instanceProtocol: http
              lbPort: 80
              lbProtocol: http
      foo:
        type: aws:elb:LoadBalancerCookieStickinessPolicy
        properties:
          name: foo-policy
          loadBalancer: ${lb.id}
          lbPort: 80
          cookieExpirationPeriod: 600
    

    Create LoadBalancerCookieStickinessPolicy Resource

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

    Constructor syntax

    new LoadBalancerCookieStickinessPolicy(name: string, args: LoadBalancerCookieStickinessPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def LoadBalancerCookieStickinessPolicy(resource_name: str,
                                           args: LoadBalancerCookieStickinessPolicyArgs,
                                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def LoadBalancerCookieStickinessPolicy(resource_name: str,
                                           opts: Optional[ResourceOptions] = None,
                                           lb_port: Optional[int] = None,
                                           load_balancer: Optional[str] = None,
                                           cookie_expiration_period: Optional[int] = None,
                                           name: Optional[str] = None)
    func NewLoadBalancerCookieStickinessPolicy(ctx *Context, name string, args LoadBalancerCookieStickinessPolicyArgs, opts ...ResourceOption) (*LoadBalancerCookieStickinessPolicy, error)
    public LoadBalancerCookieStickinessPolicy(string name, LoadBalancerCookieStickinessPolicyArgs args, CustomResourceOptions? opts = null)
    public LoadBalancerCookieStickinessPolicy(String name, LoadBalancerCookieStickinessPolicyArgs args)
    public LoadBalancerCookieStickinessPolicy(String name, LoadBalancerCookieStickinessPolicyArgs args, CustomResourceOptions options)
    
    type: aws:elb:LoadBalancerCookieStickinessPolicy
    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 LoadBalancerCookieStickinessPolicyArgs
    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 LoadBalancerCookieStickinessPolicyArgs
    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 LoadBalancerCookieStickinessPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LoadBalancerCookieStickinessPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LoadBalancerCookieStickinessPolicyArgs
    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 loadBalancerCookieStickinessPolicyResource = new Aws.Elb.LoadBalancerCookieStickinessPolicy("loadBalancerCookieStickinessPolicyResource", new()
    {
        LbPort = 0,
        LoadBalancer = "string",
        CookieExpirationPeriod = 0,
        Name = "string",
    });
    
    example, err := elb.NewLoadBalancerCookieStickinessPolicy(ctx, "loadBalancerCookieStickinessPolicyResource", &elb.LoadBalancerCookieStickinessPolicyArgs{
    	LbPort:                 pulumi.Int(0),
    	LoadBalancer:           pulumi.String("string"),
    	CookieExpirationPeriod: pulumi.Int(0),
    	Name:                   pulumi.String("string"),
    })
    
    var loadBalancerCookieStickinessPolicyResource = new LoadBalancerCookieStickinessPolicy("loadBalancerCookieStickinessPolicyResource", LoadBalancerCookieStickinessPolicyArgs.builder()
        .lbPort(0)
        .loadBalancer("string")
        .cookieExpirationPeriod(0)
        .name("string")
        .build());
    
    load_balancer_cookie_stickiness_policy_resource = aws.elb.LoadBalancerCookieStickinessPolicy("loadBalancerCookieStickinessPolicyResource",
        lb_port=0,
        load_balancer="string",
        cookie_expiration_period=0,
        name="string")
    
    const loadBalancerCookieStickinessPolicyResource = new aws.elb.LoadBalancerCookieStickinessPolicy("loadBalancerCookieStickinessPolicyResource", {
        lbPort: 0,
        loadBalancer: "string",
        cookieExpirationPeriod: 0,
        name: "string",
    });
    
    type: aws:elb:LoadBalancerCookieStickinessPolicy
    properties:
        cookieExpirationPeriod: 0
        lbPort: 0
        loadBalancer: string
        name: string
    

    LoadBalancerCookieStickinessPolicy Resource Properties

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

    Inputs

    The LoadBalancerCookieStickinessPolicy resource accepts the following input properties:

    LbPort int
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    LoadBalancer string
    The load balancer to which the policy should be attached.
    CookieExpirationPeriod int
    The time period after which the session cookie should be considered stale, expressed in seconds.
    Name string
    The name of the stickiness policy.
    LbPort int
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    LoadBalancer string
    The load balancer to which the policy should be attached.
    CookieExpirationPeriod int
    The time period after which the session cookie should be considered stale, expressed in seconds.
    Name string
    The name of the stickiness policy.
    lbPort Integer
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    loadBalancer String
    The load balancer to which the policy should be attached.
    cookieExpirationPeriod Integer
    The time period after which the session cookie should be considered stale, expressed in seconds.
    name String
    The name of the stickiness policy.
    lbPort number
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    loadBalancer string
    The load balancer to which the policy should be attached.
    cookieExpirationPeriod number
    The time period after which the session cookie should be considered stale, expressed in seconds.
    name string
    The name of the stickiness policy.
    lb_port int
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    load_balancer str
    The load balancer to which the policy should be attached.
    cookie_expiration_period int
    The time period after which the session cookie should be considered stale, expressed in seconds.
    name str
    The name of the stickiness policy.
    lbPort Number
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    loadBalancer String
    The load balancer to which the policy should be attached.
    cookieExpirationPeriod Number
    The time period after which the session cookie should be considered stale, expressed in seconds.
    name String
    The name of the stickiness policy.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the LoadBalancerCookieStickinessPolicy 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 LoadBalancerCookieStickinessPolicy Resource

    Get an existing LoadBalancerCookieStickinessPolicy 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?: LoadBalancerCookieStickinessPolicyState, opts?: CustomResourceOptions): LoadBalancerCookieStickinessPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cookie_expiration_period: Optional[int] = None,
            lb_port: Optional[int] = None,
            load_balancer: Optional[str] = None,
            name: Optional[str] = None) -> LoadBalancerCookieStickinessPolicy
    func GetLoadBalancerCookieStickinessPolicy(ctx *Context, name string, id IDInput, state *LoadBalancerCookieStickinessPolicyState, opts ...ResourceOption) (*LoadBalancerCookieStickinessPolicy, error)
    public static LoadBalancerCookieStickinessPolicy Get(string name, Input<string> id, LoadBalancerCookieStickinessPolicyState? state, CustomResourceOptions? opts = null)
    public static LoadBalancerCookieStickinessPolicy get(String name, Output<String> id, LoadBalancerCookieStickinessPolicyState 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:
    CookieExpirationPeriod int
    The time period after which the session cookie should be considered stale, expressed in seconds.
    LbPort int
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    LoadBalancer string
    The load balancer to which the policy should be attached.
    Name string
    The name of the stickiness policy.
    CookieExpirationPeriod int
    The time period after which the session cookie should be considered stale, expressed in seconds.
    LbPort int
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    LoadBalancer string
    The load balancer to which the policy should be attached.
    Name string
    The name of the stickiness policy.
    cookieExpirationPeriod Integer
    The time period after which the session cookie should be considered stale, expressed in seconds.
    lbPort Integer
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    loadBalancer String
    The load balancer to which the policy should be attached.
    name String
    The name of the stickiness policy.
    cookieExpirationPeriod number
    The time period after which the session cookie should be considered stale, expressed in seconds.
    lbPort number
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    loadBalancer string
    The load balancer to which the policy should be attached.
    name string
    The name of the stickiness policy.
    cookie_expiration_period int
    The time period after which the session cookie should be considered stale, expressed in seconds.
    lb_port int
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    load_balancer str
    The load balancer to which the policy should be attached.
    name str
    The name of the stickiness policy.
    cookieExpirationPeriod Number
    The time period after which the session cookie should be considered stale, expressed in seconds.
    lbPort Number
    The load balancer port to which the policy should be applied. This must be an active listener on the load balancer.
    loadBalancer String
    The load balancer to which the policy should be attached.
    name String
    The name of the stickiness policy.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.44.0 published on Monday, Jul 8, 2024 by Pulumi