Skip to content
v2.277.0

CfnLoadBalancerProps Struct ​

Properties for defining a CfnLoadBalancer.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const cfnLoadBalancerProps: lightsail.CfnLoadBalancerProps = {
  instancePort: 123,
  loadBalancerName: 'loadBalancerName',

  // the properties below are optional
  attachedInstances: ['attachedInstances'],
  healthCheckPath: 'healthCheckPath',
  ipAddressType: 'ipAddressType',
  sessionStickinessEnabled: false,
  sessionStickinessLbCookieDurationSeconds: 'sessionStickinessLbCookieDurationSeconds',
  tags: [{
    key: 'key',
    value: 'value',
  }],
  tlsPolicyName: 'tlsPolicyName',
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lightsail as lightsail

cfn_load_balancer_props = lightsail.CfnLoadBalancerProps(
    instance_port=123,
    load_balancer_name="loadBalancerName",

    # the properties below are optional
    attached_instances=["attachedInstances"],
    health_check_path="healthCheckPath",
    ip_address_type="ipAddressType",
    session_stickiness_enabled=False,
    session_stickiness_lb_cookie_duration_seconds="sessionStickinessLbCookieDurationSeconds",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    tls_policy_name="tlsPolicyName"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lightsail.*;

CfnLoadBalancerProps cfnLoadBalancerProps = CfnLoadBalancerProps.builder()
        .instancePort(123)
        .loadBalancerName("loadBalancerName")

        // the properties below are optional
        .attachedInstances(List.of("attachedInstances"))
        .healthCheckPath("healthCheckPath")
        .ipAddressType("ipAddressType")
        .sessionStickinessEnabled(false)
        .sessionStickinessLbCookieDurationSeconds("sessionStickinessLbCookieDurationSeconds")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .tlsPolicyName("tlsPolicyName")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lightsail;

var cfnLoadBalancerProps = new CfnLoadBalancerProps {
    InstancePort = 123,
    LoadBalancerName = "loadBalancerName",

    // the properties below are optional
    AttachedInstances = new [] { "attachedInstances" },
    HealthCheckPath = "healthCheckPath",
    IpAddressType = "ipAddressType",
    SessionStickinessEnabled = false,
    SessionStickinessLbCookieDurationSeconds = "sessionStickinessLbCookieDurationSeconds",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    TlsPolicyName = "tlsPolicyName"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnLoadBalancerProps := &CfnLoadBalancerProps{
	InstancePort: jsii.Number(123),
	LoadBalancerName: jsii.String("loadBalancerName"),

	// the properties below are optional
	AttachedInstances: []*string{
		jsii.String("attachedInstances"),
	},
	HealthCheckPath: jsii.String("healthCheckPath"),
	IpAddressType: jsii.String("ipAddressType"),
	SessionStickinessEnabled: jsii.Boolean(false),
	SessionStickinessLbCookieDurationSeconds: jsii.String("sessionStickinessLbCookieDurationSeconds"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	TlsPolicyName: jsii.String("tlsPolicyName"),
}

Properties ​

attachedInstancesoptionalstring[]attached_instancesoptionaltyping.List[str]attachedInstancesoptionalList<String>AttachedInstancesoptionalstring[]AttachedInstancesoptional*[]*string #
The Lightsail instances to attach to the load balancer.
healthCheckPathoptionalstringhealth_check_pathoptionalstrhealthCheckPathoptionalStringHealthCheckPathoptionalstringHealthCheckPathoptional*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 ).

instancePortnumberinstance_portint | floatinstancePortNumberInstancePortdoubleInstancePort*float64 required #
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 .

ipAddressTypeoptionalstringip_address_typeoptionalstripAddressTypeoptionalStringIpAddressTypeoptionalstringIpAddressTypeoptional*string #
The IP address type of the load balancer.

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

loadBalancerNamestringload_balancer_namestrloadBalancerNameStringLoadBalancerNamestringLoadBalancerName*string required #
The name of the load balancer.
sessionStickinessEnabledoptionalboolean | IResolvablesession_stickiness_enabledoptionaltyping.Union[bool, IResolvable]sessionStickinessEnabledoptionalBooleanSessionStickinessEnabledoptionalboolSessionStickinessEnabledoptionalinterface{} #
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.

sessionStickinessLbCookieDurationSecondsoptionalstringsession_stickiness_lb_cookie_duration_secondsoptionalstrsessionStickinessLbCookieDurationSecondsoptionalStringSessionStickinessLbCookieDurationSecondsoptionalstringSessionStickinessLbCookieDurationSecondsoptional*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.

tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
An array of key-value pairs to apply to this resource.

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

The Value of Tags is optional for Lightsail resources.

tlsPolicyNameoptionalstringtls_policy_nameoptionalstrtlsPolicyNameoptionalStringTlsPolicyNameoptionalstringTlsPolicyNameoptional*string #
The name of the TLS security policy for the load balancer.