Class CfnLoadBalancer

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:59.767Z") @Stability(Stable) public class CfnLoadBalancer extends CfnResource implements IInspectable
A CloudFormation AWS::Lightsail::LoadBalancer.

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.

Example:

 // 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.*;
 CfnLoadBalancer cfnLoadBalancer = CfnLoadBalancer.Builder.create(this, "MyCfnLoadBalancer")
         .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();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnLoadBalancer

      protected CfnLoadBalancer(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnLoadBalancer

      protected CfnLoadBalancer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnLoadBalancer

      @Stability(Stable) public CfnLoadBalancer(@NotNull Construct scope, @NotNull String id, @NotNull CfnLoadBalancerProps props)
      Create a new AWS::Lightsail::LoadBalancer.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrLoadBalancerArn

      @Stability(Stable) @NotNull public String getAttrLoadBalancerArn()
      The Amazon Resource Name (ARN) of the load balancer.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      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.

    • getInstancePort

      @Stability(Stable) @NotNull public Number getInstancePort()
      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 .

    • setInstancePort

      @Stability(Stable) public void setInstancePort(@NotNull Number value)
      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 .

    • getLoadBalancerName

      @Stability(Stable) @NotNull public String getLoadBalancerName()
      The name of the load balancer.
    • setLoadBalancerName

      @Stability(Stable) public void setLoadBalancerName(@NotNull String value)
      The name of the load balancer.
    • getAttachedInstances

      @Stability(Stable) @Nullable public List<String> getAttachedInstances()
      The Lightsail instances to attach to the load balancer.
    • setAttachedInstances

      @Stability(Stable) public void setAttachedInstances(@Nullable List<String> value)
      The Lightsail instances to attach to the load balancer.
    • getHealthCheckPath

      @Stability(Stable) @Nullable public String getHealthCheckPath()
      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 ).

    • setHealthCheckPath

      @Stability(Stable) public void setHealthCheckPath(@Nullable String value)
      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 ).

    • getIpAddressType

      @Stability(Stable) @Nullable public String getIpAddressType()
      The IP address type of the load balancer.

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

    • setIpAddressType

      @Stability(Stable) public void setIpAddressType(@Nullable String value)
      The IP address type of the load balancer.

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

    • getSessionStickinessEnabled

      @Stability(Stable) @Nullable public Object getSessionStickinessEnabled()
      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.

    • setSessionStickinessEnabled

      @Stability(Stable) public void setSessionStickinessEnabled(@Nullable Boolean value)
      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.

    • setSessionStickinessEnabled

      @Stability(Stable) public void setSessionStickinessEnabled(@Nullable IResolvable value)
      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.

    • getSessionStickinessLbCookieDurationSeconds

      @Stability(Stable) @Nullable public String getSessionStickinessLbCookieDurationSeconds()
      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.

    • setSessionStickinessLbCookieDurationSeconds

      @Stability(Stable) public void setSessionStickinessLbCookieDurationSeconds(@Nullable String value)
      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.

    • getTlsPolicyName

      @Stability(Stable) @Nullable public String getTlsPolicyName()
      The name of the TLS security policy for the load balancer.
    • setTlsPolicyName

      @Stability(Stable) public void setTlsPolicyName(@Nullable String value)
      The name of the TLS security policy for the load balancer.