AWS::Lightsail::LoadBalancer - AWS CloudFormation

AWS::Lightsail::LoadBalancer

The AWS::Lightsail::LoadBalancer resource specifies a load balancer that can be used with Lightsail instances.

Note

You cannot attach a TLS certificate to a load balancer using the AWS::Lightsail::LoadBalancer resource type. Instead, use the AWS::Lightsail::LoadBalancerTlsCertificate resource type to create a certificate and attach it to a load balancer.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::Lightsail::LoadBalancer", "Properties" : { "AttachedInstances" : [ String, ... ], "HealthCheckPath" : String, "InstancePort" : Integer, "IpAddressType" : String, "LoadBalancerName" : String, "SessionStickinessEnabled" : Boolean, "SessionStickinessLBCookieDurationSeconds" : String, "Tags" : [ Tag, ... ], "TlsPolicyName" : String } }

YAML

Type: AWS::Lightsail::LoadBalancer Properties: AttachedInstances: - String HealthCheckPath: String InstancePort: Integer IpAddressType: String LoadBalancerName: String SessionStickinessEnabled: Boolean SessionStickinessLBCookieDurationSeconds: String Tags: - Tag TlsPolicyName: String

Properties

AttachedInstances

The Lightsail instances to attach to the load balancer.

Required: No

Type: Array of String

Update requires: No interruption

HealthCheckPath

The path on the attached instance where the health check will be performed. If no path is specified, the load balancer tries to make a request to the default (root) page (/index.html).

Required: No

Type: String

Pattern: .*\S.*

Update requires: No interruption

InstancePort

The port that the load balancer uses to direct traffic to your Lightsail instances. For HTTP traffic, specify port 80. For HTTPS traffic, specify port 443.

Required: Yes

Type: Integer

Update requires: Updates are not supported.

IpAddressType

The IP address type of the load balancer.

The possible values are ipv4 for IPv4 only, and dualstack for both IPv4 and IPv6.

Required: No

Type: String

Allowed values: dualstack | ipv4 | ipv6

Update requires: Updates are not supported.

LoadBalancerName

The name of the load balancer.

Required: Yes

Type: String

Pattern: \w[\w\-]*\w

Update requires: Updates are not supported.

SessionStickinessEnabled

A Boolean value indicating whether session stickiness is enabled.

Enable session stickiness (also known as session affinity) to bind a user's session to a specific instance. This ensures that all requests from the user during the session are sent to the same instance.

Required: No

Type: Boolean

Update requires: No interruption

SessionStickinessLBCookieDurationSeconds

The time period, in seconds, after which the load balancer session stickiness cookie should be considered stale. If you do not specify this parameter, the default value is 0, which indicates that the sticky session should last for the duration of the browser session.

Required: No

Type: String

Update requires: No interruption

Tags

An array of key-value pairs to apply to this resource.

For more information, see Tag in the AWS CloudFormation User Guide.

Note

The Value of Tags is optional for Lightsail resources.

Required: No

Type: Array of Tag

Update requires: No interruption

TlsPolicyName

The name of the TLS security policy for the load balancer.

Required: No

Type: String

Pattern: \w[\w\-]*\w

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns a unique identifier for this resource.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

LoadBalancerArn

The Amazon Resource Name (ARN) of the load balancer.

Remarks

Load balancer TLS certificate

You cannot attach a TLS certificate to a load balancer using the AWS::Lightsail::LoadBalancer resource type. Instead, use the AWS::Lightsail::LoadBalancerTlsCertificate resource type to create and attach certificates to a load balancer.

Configuring HTTPS redirection

HTTPS redirection can only be set using the HttpsRedirectionEnabled parameter on the AWS::Lightsail::LoadBalancerTlsCertificate resource that is attached to the load balancer.