1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. Lb
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

aws.lightsail.Lb

Explore with Pulumi AI

aws logo
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

    Manages a Lightsail load balancer resource.

    Use this resource to distribute incoming traffic across multiple Lightsail instances to improve application availability and performance.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.lightsail.Lb("example", {
        name: "example-load-balancer",
        healthCheckPath: "/",
        instancePort: 80,
        tags: {
            foo: "bar",
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.lightsail.Lb("example",
        name="example-load-balancer",
        health_check_path="/",
        instance_port=80,
        tags={
            "foo": "bar",
        })
    
    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 {
    		_, err := lightsail.NewLb(ctx, "example", &lightsail.LbArgs{
    			Name:            pulumi.String("example-load-balancer"),
    			HealthCheckPath: pulumi.String("/"),
    			InstancePort:    pulumi.Int(80),
    			Tags: pulumi.StringMap{
    				"foo": pulumi.String("bar"),
    			},
    		})
    		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 example = new Aws.LightSail.Lb("example", new()
        {
            Name = "example-load-balancer",
            HealthCheckPath = "/",
            InstancePort = 80,
            Tags = 
            {
                { "foo", "bar" },
            },
        });
    
    });
    
    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 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 example = new Lb("example", LbArgs.builder()
                .name("example-load-balancer")
                .healthCheckPath("/")
                .instancePort(80)
                .tags(Map.of("foo", "bar"))
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:lightsail:Lb
        properties:
          name: example-load-balancer
          healthCheckPath: /
          instancePort: 80
          tags:
            foo: bar
    

    Create Lb Resource

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

    Constructor syntax

    new Lb(name: string, args: LbArgs, opts?: CustomResourceOptions);
    @overload
    def Lb(resource_name: str,
           args: LbArgs,
           opts: Optional[ResourceOptions] = None)
    
    @overload
    def Lb(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           instance_port: Optional[int] = None,
           health_check_path: Optional[str] = None,
           ip_address_type: Optional[str] = None,
           name: Optional[str] = None,
           tags: Optional[Mapping[str, str]] = None)
    func NewLb(ctx *Context, name string, args LbArgs, opts ...ResourceOption) (*Lb, error)
    public Lb(string name, LbArgs args, CustomResourceOptions? opts = null)
    public Lb(String name, LbArgs args)
    public Lb(String name, LbArgs args, CustomResourceOptions options)
    
    type: aws:lightsail:Lb
    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 LbArgs
    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 LbArgs
    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 LbArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LbArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LbArgs
    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 lbResource = new Aws.LightSail.Lb("lbResource", new()
    {
        InstancePort = 0,
        HealthCheckPath = "string",
        IpAddressType = "string",
        Name = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := lightsail.NewLb(ctx, "lbResource", &lightsail.LbArgs{
    	InstancePort:    pulumi.Int(0),
    	HealthCheckPath: pulumi.String("string"),
    	IpAddressType:   pulumi.String("string"),
    	Name:            pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var lbResource = new Lb("lbResource", LbArgs.builder()
        .instancePort(0)
        .healthCheckPath("string")
        .ipAddressType("string")
        .name("string")
        .tags(Map.of("string", "string"))
        .build());
    
    lb_resource = aws.lightsail.Lb("lbResource",
        instance_port=0,
        health_check_path="string",
        ip_address_type="string",
        name="string",
        tags={
            "string": "string",
        })
    
    const lbResource = new aws.lightsail.Lb("lbResource", {
        instancePort: 0,
        healthCheckPath: "string",
        ipAddressType: "string",
        name: "string",
        tags: {
            string: "string",
        },
    });
    
    type: aws:lightsail:Lb
    properties:
        healthCheckPath: string
        instancePort: 0
        ipAddressType: string
        name: string
        tags:
            string: string
    

    Lb 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 Lb resource accepts the following input properties:

    InstancePort int
    Instance port the load balancer will connect to.
    HealthCheckPath string
    Health check path of the load balancer. Default value /.
    IpAddressType string
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    Name string

    Name of the Lightsail load balancer.

    The following arguments are optional:

    Tags Dictionary<string, string>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    InstancePort int
    Instance port the load balancer will connect to.
    HealthCheckPath string
    Health check path of the load balancer. Default value /.
    IpAddressType string
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    Name string

    Name of the Lightsail load balancer.

    The following arguments are optional:

    Tags map[string]string
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    instancePort Integer
    Instance port the load balancer will connect to.
    healthCheckPath String
    Health check path of the load balancer. Default value /.
    ipAddressType String
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name String

    Name of the Lightsail load balancer.

    The following arguments are optional:

    tags Map<String,String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    instancePort number
    Instance port the load balancer will connect to.
    healthCheckPath string
    Health check path of the load balancer. Default value /.
    ipAddressType string
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name string

    Name of the Lightsail load balancer.

    The following arguments are optional:

    tags {[key: string]: string}
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    instance_port int
    Instance port the load balancer will connect to.
    health_check_path str
    Health check path of the load balancer. Default value /.
    ip_address_type str
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name str

    Name of the Lightsail load balancer.

    The following arguments are optional:

    tags Mapping[str, str]
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    instancePort Number
    Instance port the load balancer will connect to.
    healthCheckPath String
    Health check path of the load balancer. Default value /.
    ipAddressType String
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name String

    Name of the Lightsail load balancer.

    The following arguments are optional:

    tags Map<String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Outputs

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

    Arn string
    ARN of the Lightsail load balancer.
    CreatedAt string
    Timestamp when the load balancer was created.
    DnsName string
    DNS name of the load balancer.
    Id string
    The provider-assigned unique ID for this managed resource.
    Protocol string
    Protocol of the load balancer.
    PublicPorts List<int>
    Public ports of the load balancer.
    SupportCode string
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    TagsAll Dictionary<string, string>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    ARN of the Lightsail load balancer.
    CreatedAt string
    Timestamp when the load balancer was created.
    DnsName string
    DNS name of the load balancer.
    Id string
    The provider-assigned unique ID for this managed resource.
    Protocol string
    Protocol of the load balancer.
    PublicPorts []int
    Public ports of the load balancer.
    SupportCode string
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    TagsAll map[string]string
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail load balancer.
    createdAt String
    Timestamp when the load balancer was created.
    dnsName String
    DNS name of the load balancer.
    id String
    The provider-assigned unique ID for this managed resource.
    protocol String
    Protocol of the load balancer.
    publicPorts List<Integer>
    Public ports of the load balancer.
    supportCode String
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tagsAll Map<String,String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    ARN of the Lightsail load balancer.
    createdAt string
    Timestamp when the load balancer was created.
    dnsName string
    DNS name of the load balancer.
    id string
    The provider-assigned unique ID for this managed resource.
    protocol string
    Protocol of the load balancer.
    publicPorts number[]
    Public ports of the load balancer.
    supportCode string
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tagsAll {[key: string]: string}
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    ARN of the Lightsail load balancer.
    created_at str
    Timestamp when the load balancer was created.
    dns_name str
    DNS name of the load balancer.
    id str
    The provider-assigned unique ID for this managed resource.
    protocol str
    Protocol of the load balancer.
    public_ports Sequence[int]
    Public ports of the load balancer.
    support_code str
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tags_all Mapping[str, str]
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail load balancer.
    createdAt String
    Timestamp when the load balancer was created.
    dnsName String
    DNS name of the load balancer.
    id String
    The provider-assigned unique ID for this managed resource.
    protocol String
    Protocol of the load balancer.
    publicPorts List<Number>
    Public ports of the load balancer.
    supportCode String
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tagsAll Map<String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Look up Existing Lb Resource

    Get an existing Lb 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?: LbState, opts?: CustomResourceOptions): Lb
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            created_at: Optional[str] = None,
            dns_name: Optional[str] = None,
            health_check_path: Optional[str] = None,
            instance_port: Optional[int] = None,
            ip_address_type: Optional[str] = None,
            name: Optional[str] = None,
            protocol: Optional[str] = None,
            public_ports: Optional[Sequence[int]] = None,
            support_code: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None) -> Lb
    func GetLb(ctx *Context, name string, id IDInput, state *LbState, opts ...ResourceOption) (*Lb, error)
    public static Lb Get(string name, Input<string> id, LbState? state, CustomResourceOptions? opts = null)
    public static Lb get(String name, Output<String> id, LbState state, CustomResourceOptions options)
    resources:  _:    type: aws:lightsail:Lb    get:      id: ${id}
    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:
    Arn string
    ARN of the Lightsail load balancer.
    CreatedAt string
    Timestamp when the load balancer was created.
    DnsName string
    DNS name of the load balancer.
    HealthCheckPath string
    Health check path of the load balancer. Default value /.
    InstancePort int
    Instance port the load balancer will connect to.
    IpAddressType string
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    Name string

    Name of the Lightsail load balancer.

    The following arguments are optional:

    Protocol string
    Protocol of the load balancer.
    PublicPorts List<int>
    Public ports of the load balancer.
    SupportCode string
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    Tags Dictionary<string, string>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll Dictionary<string, string>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    ARN of the Lightsail load balancer.
    CreatedAt string
    Timestamp when the load balancer was created.
    DnsName string
    DNS name of the load balancer.
    HealthCheckPath string
    Health check path of the load balancer. Default value /.
    InstancePort int
    Instance port the load balancer will connect to.
    IpAddressType string
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    Name string

    Name of the Lightsail load balancer.

    The following arguments are optional:

    Protocol string
    Protocol of the load balancer.
    PublicPorts []int
    Public ports of the load balancer.
    SupportCode string
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    Tags map[string]string
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll map[string]string
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail load balancer.
    createdAt String
    Timestamp when the load balancer was created.
    dnsName String
    DNS name of the load balancer.
    healthCheckPath String
    Health check path of the load balancer. Default value /.
    instancePort Integer
    Instance port the load balancer will connect to.
    ipAddressType String
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name String

    Name of the Lightsail load balancer.

    The following arguments are optional:

    protocol String
    Protocol of the load balancer.
    publicPorts List<Integer>
    Public ports of the load balancer.
    supportCode String
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tags Map<String,String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String,String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    ARN of the Lightsail load balancer.
    createdAt string
    Timestamp when the load balancer was created.
    dnsName string
    DNS name of the load balancer.
    healthCheckPath string
    Health check path of the load balancer. Default value /.
    instancePort number
    Instance port the load balancer will connect to.
    ipAddressType string
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name string

    Name of the Lightsail load balancer.

    The following arguments are optional:

    protocol string
    Protocol of the load balancer.
    publicPorts number[]
    Public ports of the load balancer.
    supportCode string
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tags {[key: string]: string}
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll {[key: string]: string}
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    ARN of the Lightsail load balancer.
    created_at str
    Timestamp when the load balancer was created.
    dns_name str
    DNS name of the load balancer.
    health_check_path str
    Health check path of the load balancer. Default value /.
    instance_port int
    Instance port the load balancer will connect to.
    ip_address_type str
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name str

    Name of the Lightsail load balancer.

    The following arguments are optional:

    protocol str
    Protocol of the load balancer.
    public_ports Sequence[int]
    Public ports of the load balancer.
    support_code str
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tags Mapping[str, str]
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all Mapping[str, str]
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the Lightsail load balancer.
    createdAt String
    Timestamp when the load balancer was created.
    dnsName String
    DNS name of the load balancer.
    healthCheckPath String
    Health check path of the load balancer. Default value /.
    instancePort Number
    Instance port the load balancer will connect to.
    ipAddressType String
    IP address type of the load balancer. Valid values: dualstack, ipv4. Default value dualstack.
    name String

    Name of the Lightsail load balancer.

    The following arguments are optional:

    protocol String
    Protocol of the load balancer.
    publicPorts List<Number>
    Public ports of the load balancer.
    supportCode String
    Support code for the load balancer. Include this code in your email to support when you have questions about a load balancer in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    tags Map<String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Import

    Using pulumi import, import aws_lightsail_lb using the name attribute. For example:

    $ pulumi import aws:lightsail/lb:Lb example 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.83.0 published on Monday, Jun 16, 2025 by Pulumi