aws.lightsail.Lb
Explore with Pulumi AI
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)
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:
- Instance
Port int - Instance port the load balancer will connect to.
- Health
Check stringPath - Health check path of the load balancer. Default value
/
. - Ip
Address stringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - Name string
Name of the Lightsail load balancer.
The following arguments are optional:
- 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.
- Instance
Port int - Instance port the load balancer will connect to.
- Health
Check stringPath - Health check path of the load balancer. Default value
/
. - Ip
Address stringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - Name string
Name of the Lightsail load balancer.
The following arguments are optional:
- 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.
- instance
Port Integer - Instance port the load balancer will connect to.
- health
Check StringPath - Health check path of the load balancer. Default value
/
. - ip
Address StringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - name String
Name of the Lightsail load balancer.
The following arguments are optional:
- 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.
- instance
Port number - Instance port the load balancer will connect to.
- health
Check stringPath - Health check path of the load balancer. Default value
/
. - ip
Address stringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - name string
Name of the Lightsail load balancer.
The following arguments are optional:
- {[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_ strpath - Health check path of the load balancer. Default value
/
. - ip_
address_ strtype - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - name str
Name of the Lightsail load balancer.
The following arguments are optional:
- 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.
- instance
Port Number - Instance port the load balancer will connect to.
- health
Check StringPath - Health check path of the load balancer. Default value
/
. - ip
Address StringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - name String
Name of the Lightsail load balancer.
The following arguments are optional:
- 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.
- Created
At string - Timestamp when the load balancer was created.
- Dns
Name 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.
- Public
Ports List<int> - Public ports of the load balancer.
- Support
Code 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.
- Dictionary<string, string>
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Arn string
- ARN of the Lightsail load balancer.
- Created
At string - Timestamp when the load balancer was created.
- Dns
Name 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.
- Public
Ports []int - Public ports of the load balancer.
- Support
Code 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.
- map[string]string
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- ARN of the Lightsail load balancer.
- created
At String - Timestamp when the load balancer was created.
- dns
Name 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.
- public
Ports List<Integer> - Public ports of the load balancer.
- support
Code 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.
- Map<String,String>
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn string
- ARN of the Lightsail load balancer.
- created
At string - Timestamp when the load balancer was created.
- dns
Name 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.
- public
Ports number[] - Public ports of the load balancer.
- support
Code 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.
- {[key: string]: string}
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- 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.
- Mapping[str, str]
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- ARN of the Lightsail load balancer.
- created
At String - Timestamp when the load balancer was created.
- dns
Name 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.
- public
Ports List<Number> - Public ports of the load balancer.
- support
Code 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.
- Map<String>
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
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.
- Arn string
- ARN of the Lightsail load balancer.
- Created
At string - Timestamp when the load balancer was created.
- Dns
Name string - DNS name of the load balancer.
- Health
Check stringPath - Health check path of the load balancer. Default value
/
. - Instance
Port int - Instance port the load balancer will connect to.
- Ip
Address stringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - Name string
Name of the Lightsail load balancer.
The following arguments are optional:
- Protocol string
- Protocol of the load balancer.
- Public
Ports List<int> - Public ports of the load balancer.
- Support
Code 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.
- 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. - Dictionary<string, string>
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Arn string
- ARN of the Lightsail load balancer.
- Created
At string - Timestamp when the load balancer was created.
- Dns
Name string - DNS name of the load balancer.
- Health
Check stringPath - Health check path of the load balancer. Default value
/
. - Instance
Port int - Instance port the load balancer will connect to.
- Ip
Address stringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - Name string
Name of the Lightsail load balancer.
The following arguments are optional:
- Protocol string
- Protocol of the load balancer.
- Public
Ports []int - Public ports of the load balancer.
- Support
Code 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.
- 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. - map[string]string
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- ARN of the Lightsail load balancer.
- created
At String - Timestamp when the load balancer was created.
- dns
Name String - DNS name of the load balancer.
- health
Check StringPath - Health check path of the load balancer. Default value
/
. - instance
Port Integer - Instance port the load balancer will connect to.
- ip
Address StringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - name String
Name of the Lightsail load balancer.
The following arguments are optional:
- protocol String
- Protocol of the load balancer.
- public
Ports List<Integer> - Public ports of the load balancer.
- support
Code 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.
- 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. - Map<String,String>
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn string
- ARN of the Lightsail load balancer.
- created
At string - Timestamp when the load balancer was created.
- dns
Name string - DNS name of the load balancer.
- health
Check stringPath - Health check path of the load balancer. Default value
/
. - instance
Port number - Instance port the load balancer will connect to.
- ip
Address stringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - name string
Name of the Lightsail load balancer.
The following arguments are optional:
- protocol string
- Protocol of the load balancer.
- public
Ports number[] - Public ports of the load balancer.
- support
Code 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.
- {[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. - {[key: string]: string}
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- 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_ strpath - Health check path of the load balancer. Default value
/
. - instance_
port int - Instance port the load balancer will connect to.
- ip_
address_ strtype - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - 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.
- 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. - Mapping[str, str]
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- ARN of the Lightsail load balancer.
- created
At String - Timestamp when the load balancer was created.
- dns
Name String - DNS name of the load balancer.
- health
Check StringPath - Health check path of the load balancer. Default value
/
. - instance
Port Number - Instance port the load balancer will connect to.
- ip
Address StringType - IP address type of the load balancer. Valid values:
dualstack
,ipv4
. Default valuedualstack
. - name String
Name of the Lightsail load balancer.
The following arguments are optional:
- protocol String
- Protocol of the load balancer.
- public
Ports List<Number> - Public ports of the load balancer.
- support
Code 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.
- 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. - Map<String>
- Map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
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.