1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. Lb
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.lightsail.Lb

Explore with Pulumi AI

Creates a Lightsail load balancer resource.

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",
    },
});
Copy
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",
    })
Copy
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, "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
		}
		return nil
	})
}
Copy
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" },
        },
    });

});
Copy
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 test = new Lb("test", LbArgs.builder()
            .name("test-load-balancer")
            .healthCheckPath("/")
            .instancePort(80)
            .tags(Map.of("foo", "bar"))
            .build());

    }
}
Copy
resources:
  test:
    type: aws:lightsail:Lb
    properties:
      name: test-load-balancer
      healthCheckPath: /
      instancePort: '80'
      tags:
        foo: bar
Copy

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 This property is required. string
The unique name of the resource.
args This property is required. LbArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. LbArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. LbArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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" },
    },
});
Copy
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"),
	},
})
Copy
var lbResource = new Lb("lbResource", LbArgs.builder()
    .instancePort(0)
    .healthCheckPath("string")
    .ipAddressType("string")
    .name("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
lb_resource = aws.lightsail.Lb("lbResource",
    instance_port=0,
    health_check_path="string",
    ip_address_type="string",
    name="string",
    tags={
        "string": "string",
    })
Copy
const lbResource = new aws.lightsail.Lb("lbResource", {
    instancePort: 0,
    healthCheckPath: "string",
    ipAddressType: "string",
    name: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:lightsail:Lb
properties:
    healthCheckPath: string
    instancePort: 0
    ipAddressType: string
    name: string
    tags:
        string: string
Copy

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
This property is required.
Changes to this property will trigger replacement.
int
The instance port the load balancer will connect.
HealthCheckPath string
The health check path of the load balancer. Default value "/".
IpAddressType string
Name Changes to this property will trigger replacement. string
The name of the Lightsail load balancer.
Tags Dictionary<string, string>
A 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
This property is required.
Changes to this property will trigger replacement.
int
The instance port the load balancer will connect.
HealthCheckPath string
The health check path of the load balancer. Default value "/".
IpAddressType string
Name Changes to this property will trigger replacement. string
The name of the Lightsail load balancer.
Tags map[string]string
A 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
This property is required.
Changes to this property will trigger replacement.
Integer
The instance port the load balancer will connect.
healthCheckPath String
The health check path of the load balancer. Default value "/".
ipAddressType String
name Changes to this property will trigger replacement. String
The name of the Lightsail load balancer.
tags Map<String,String>
A 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
This property is required.
Changes to this property will trigger replacement.
number
The instance port the load balancer will connect.
healthCheckPath string
The health check path of the load balancer. Default value "/".
ipAddressType string
name Changes to this property will trigger replacement. string
The name of the Lightsail load balancer.
tags {[key: string]: string}
A 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
This property is required.
Changes to this property will trigger replacement.
int
The instance port the load balancer will connect.
health_check_path str
The health check path of the load balancer. Default value "/".
ip_address_type str
name Changes to this property will trigger replacement. str
The name of the Lightsail load balancer.
tags Mapping[str, str]
A 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
This property is required.
Changes to this property will trigger replacement.
Number
The instance port the load balancer will connect.
healthCheckPath String
The health check path of the load balancer. Default value "/".
ipAddressType String
name Changes to this property will trigger replacement. String
The name of the Lightsail load balancer.
tags Map<String>
A 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
The ARN of the Lightsail load balancer.
CreatedAt string
The timestamp when the load balancer was created.
DnsName string
The DNS name of the load balancer.
Id string
The provider-assigned unique ID for this managed resource.
Protocol string
The protocol of the load balancer.
PublicPorts List<int>
The public ports of the load balancer.
SupportCode string
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

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

Deprecated: Please use tags instead.

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

Deprecated: Please use tags instead.

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

Deprecated: Please use tags instead.

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

Deprecated: Please use tags instead.

arn String
The ARN of the Lightsail load balancer.
createdAt String
The timestamp when the load balancer was created.
dnsName String
The DNS name of the load balancer.
id String
The provider-assigned unique ID for this managed resource.
protocol String
The protocol of the load balancer.
publicPorts List<Number>
The public ports of the load balancer.
supportCode String
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tagsAll Map<String>
A 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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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
The ARN of the Lightsail load balancer.
CreatedAt string
The timestamp when the load balancer was created.
DnsName string
The DNS name of the load balancer.
HealthCheckPath string
The health check path of the load balancer. Default value "/".
InstancePort Changes to this property will trigger replacement. int
The instance port the load balancer will connect.
IpAddressType string
Name Changes to this property will trigger replacement. string
The name of the Lightsail load balancer.
Protocol string
The protocol of the load balancer.
PublicPorts List<int>
The public ports of the load balancer.
SupportCode string
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
Tags Dictionary<string, string>
A 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>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
The ARN of the Lightsail load balancer.
CreatedAt string
The timestamp when the load balancer was created.
DnsName string
The DNS name of the load balancer.
HealthCheckPath string
The health check path of the load balancer. Default value "/".
InstancePort Changes to this property will trigger replacement. int
The instance port the load balancer will connect.
IpAddressType string
Name Changes to this property will trigger replacement. string
The name of the Lightsail load balancer.
Protocol string
The protocol of the load balancer.
PublicPorts []int
The public ports of the load balancer.
SupportCode string
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
Tags map[string]string
A 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
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the Lightsail load balancer.
createdAt String
The timestamp when the load balancer was created.
dnsName String
The DNS name of the load balancer.
healthCheckPath String
The health check path of the load balancer. Default value "/".
instancePort Changes to this property will trigger replacement. Integer
The instance port the load balancer will connect.
ipAddressType String
name Changes to this property will trigger replacement. String
The name of the Lightsail load balancer.
protocol String
The protocol of the load balancer.
publicPorts List<Integer>
The public ports of the load balancer.
supportCode String
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags Map<String,String>
A 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>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
The ARN of the Lightsail load balancer.
createdAt string
The timestamp when the load balancer was created.
dnsName string
The DNS name of the load balancer.
healthCheckPath string
The health check path of the load balancer. Default value "/".
instancePort Changes to this property will trigger replacement. number
The instance port the load balancer will connect.
ipAddressType string
name Changes to this property will trigger replacement. string
The name of the Lightsail load balancer.
protocol string
The protocol of the load balancer.
publicPorts number[]
The public ports of the load balancer.
supportCode string
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags {[key: string]: string}
A 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}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
The ARN of the Lightsail load balancer.
created_at str
The timestamp when the load balancer was created.
dns_name str
The DNS name of the load balancer.
health_check_path str
The health check path of the load balancer. Default value "/".
instance_port Changes to this property will trigger replacement. int
The instance port the load balancer will connect.
ip_address_type str
name Changes to this property will trigger replacement. str
The name of the Lightsail load balancer.
protocol str
The protocol of the load balancer.
public_ports Sequence[int]
The public ports of the load balancer.
support_code str
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags Mapping[str, str]
A 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]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the Lightsail load balancer.
createdAt String
The timestamp when the load balancer was created.
dnsName String
The DNS name of the load balancer.
healthCheckPath String
The health check path of the load balancer. Default value "/".
instancePort Changes to this property will trigger replacement. Number
The instance port the load balancer will connect.
ipAddressType String
name Changes to this property will trigger replacement. String
The name of the Lightsail load balancer.
protocol String
The protocol of the load balancer.
publicPorts List<Number>
The public ports of the load balancer.
supportCode String
The support code for the database. Include this code in your email to support when you have questions about a database in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags Map<String>
A 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>
A 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 test example-load-balancer
Copy

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.