AWS::Lightsail::LoadBalancerThe `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 { CfnLoadBalancer } from 'aws-cdk-lib/aws-lightsail';Or use the module namespace:
import * as lightsail from 'aws-cdk-lib/aws-lightsail';
// lightsail.CfnLoadBalancerConfiguration passed to the constructor as CfnLoadBalancerProps.
instancePortRequirednumberThe 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` .
loadBalancerNameRequiredstringThe name of the load balancer.
attachedInstancesOptionalstring[]The Lightsail instances to attach to the load balancer.
healthCheckPathOptionalstringThe 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` ).
ipAddressTypeOptionalstringThe IP address type of the load balancer. The possible values are `ipv4` for IPv4 only, and `dualstack` for both IPv4 and IPv6.
sessionStickinessEnabledOptionalboolean | IResolvableA 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.
sessionStickinessLbCookieDurationSecondsOptionalstringThe 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.
tagsOptionalCfnTag[]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.
tlsPolicyNameOptionalstringThe name of the TLS security policy for the load balancer.
This L1 construct maps directly to the following CloudFormation resource type.
Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.
Subscribe to Newsletteraws-lightsailAWS::Lightsail::LoadBalancer