AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::Lightsail::LoadBalancer

CfnLoadBalancer

The `AWS::Lightsail::LoadBalancer` resource specifies a load balancer that can be used with Lightsail instances. > 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.

Import

import { CfnLoadBalancer } from 'aws-cdk-lib/aws-lightsail';

Or use the module namespace:

import * as lightsail from 'aws-cdk-lib/aws-lightsail';
// lightsail.CfnLoadBalancer

Properties

Configuration passed to the constructor as CfnLoadBalancerProps.

instancePortRequired
number

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` .

loadBalancerNameRequired
string

The name of the load balancer.

attachedInstancesOptional
string[]

The Lightsail instances to attach to the load balancer.

healthCheckPathOptional
string

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` ).

ipAddressTypeOptional
string

The IP address type of the load balancer. The possible values are `ipv4` for IPv4 only, and `dualstack` for both IPv4 and IPv6.

sessionStickinessEnabledOptional
boolean | IResolvable

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.

sessionStickinessLbCookieDurationSecondsOptional
string

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.

tagsOptional
CfnTag[]

An array of key-value pairs to apply to this resource. For more information, see [Tag](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html) in the *AWS CloudFormation User Guide* . > The `Value` of `Tags` is optional for Lightsail resources.

tlsPolicyNameOptional
string

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

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter