java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.elasticloadbalancing.CfnLoadBalancer
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-24T02:42:38.015Z") @Stability(Stable) public class CfnLoadBalancer extends CfnResource implements IInspectable, ITaggable
Specifies a Classic Load Balancer.

If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn attribute to declare a dependency on the VPC-gateway attachment.

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.elasticloadbalancing.*;
 Object attributes;
 CfnLoadBalancer cfnLoadBalancer = CfnLoadBalancer.Builder.create(this, "MyCfnLoadBalancer")
         .listeners(List.of(ListenersProperty.builder()
                 .instancePort("instancePort")
                 .loadBalancerPort("loadBalancerPort")
                 .protocol("protocol")
                 // the properties below are optional
                 .instanceProtocol("instanceProtocol")
                 .policyNames(List.of("policyNames"))
                 .sslCertificateId("sslCertificateId")
                 .build()))
         // the properties below are optional
         .accessLoggingPolicy(AccessLoggingPolicyProperty.builder()
                 .enabled(false)
                 .s3BucketName("s3BucketName")
                 // the properties below are optional
                 .emitInterval(123)
                 .s3BucketPrefix("s3BucketPrefix")
                 .build())
         .appCookieStickinessPolicy(List.of(AppCookieStickinessPolicyProperty.builder()
                 .cookieName("cookieName")
                 .policyName("policyName")
                 .build()))
         .availabilityZones(List.of("availabilityZones"))
         .connectionDrainingPolicy(ConnectionDrainingPolicyProperty.builder()
                 .enabled(false)
                 // the properties below are optional
                 .timeout(123)
                 .build())
         .connectionSettings(ConnectionSettingsProperty.builder()
                 .idleTimeout(123)
                 .build())
         .crossZone(false)
         .healthCheck(HealthCheckProperty.builder()
                 .healthyThreshold("healthyThreshold")
                 .interval("interval")
                 .target("target")
                 .timeout("timeout")
                 .unhealthyThreshold("unhealthyThreshold")
                 .build())
         .instances(List.of("instances"))
         .lbCookieStickinessPolicy(List.of(LBCookieStickinessPolicyProperty.builder()
                 .cookieExpirationPeriod("cookieExpirationPeriod")
                 .policyName("policyName")
                 .build()))
         .loadBalancerName("loadBalancerName")
         .policies(List.of(PoliciesProperty.builder()
                 .attributes(List.of(attributes))
                 .policyName("policyName")
                 .policyType("policyType")
                 // the properties below are optional
                 .instancePorts(List.of("instancePorts"))
                 .loadBalancerPorts(List.of("loadBalancerPorts"))
                 .build()))
         .scheme("scheme")
         .securityGroups(List.of("securityGroups"))
         .subnets(List.of("subnets"))
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • 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 software.constructs.Construct scope, @NotNull String id, @NotNull CfnLoadBalancerProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). 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.
    • getAttrCanonicalHostedZoneName

      @Stability(Stable) @NotNull public String getAttrCanonicalHostedZoneName()
      The name of the Route 53 hosted zone that is associated with the load balancer.

      Internal-facing load balancers don't use this value, use DNSName instead.

    • getAttrCanonicalHostedZoneNameId

      @Stability(Stable) @NotNull public String getAttrCanonicalHostedZoneNameId()
      The ID of the Route 53 hosted zone name that is associated with the load balancer.
    • getAttrDnsName

      @Stability(Stable) @NotNull public String getAttrDnsName()
      The DNS name for the load balancer.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
    • getAttrSourceSecurityGroupGroupName

      @Stability(Stable) @NotNull public String getAttrSourceSecurityGroupGroupName()
      The name of the security group that you can use as part of your inbound rules for your load balancer's back-end instances.
    • getAttrSourceSecurityGroupOwnerAlias

      @Stability(Stable) @NotNull public String getAttrSourceSecurityGroupOwnerAlias()
      The owner of the source security group.
    • getCfnProperties

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

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getListeners

      @Stability(Stable) @NotNull public Object getListeners()
      The listeners for the load balancer.

      You can specify at most one listener per port.

    • setListeners

      @Stability(Stable) public void setListeners(@NotNull IResolvable value)
      The listeners for the load balancer.

      You can specify at most one listener per port.

    • setListeners

      @Stability(Stable) public void setListeners(@NotNull List<Object> value)
      The listeners for the load balancer.

      You can specify at most one listener per port.

    • getAccessLoggingPolicy

      @Stability(Stable) @Nullable public Object getAccessLoggingPolicy()
      Information about where and how access logs are stored for the load balancer.
    • setAccessLoggingPolicy

      @Stability(Stable) public void setAccessLoggingPolicy(@Nullable IResolvable value)
      Information about where and how access logs are stored for the load balancer.
    • setAccessLoggingPolicy

      @Stability(Stable) public void setAccessLoggingPolicy(@Nullable CfnLoadBalancer.AccessLoggingPolicyProperty value)
      Information about where and how access logs are stored for the load balancer.
    • getAppCookieStickinessPolicy

      @Stability(Stable) @Nullable public Object getAppCookieStickinessPolicy()
      Information about a policy for application-controlled session stickiness.
    • setAppCookieStickinessPolicy

      @Stability(Stable) public void setAppCookieStickinessPolicy(@Nullable IResolvable value)
      Information about a policy for application-controlled session stickiness.
    • setAppCookieStickinessPolicy

      @Stability(Stable) public void setAppCookieStickinessPolicy(@Nullable List<Object> value)
      Information about a policy for application-controlled session stickiness.
    • getAvailabilityZones

      @Stability(Stable) @Nullable public List<String> getAvailabilityZones()
      The Availability Zones for a load balancer in a default VPC.
    • setAvailabilityZones

      @Stability(Stable) public void setAvailabilityZones(@Nullable List<String> value)
      The Availability Zones for a load balancer in a default VPC.
    • getConnectionDrainingPolicy

      @Stability(Stable) @Nullable public Object getConnectionDrainingPolicy()
      If enabled, the load balancer allows existing requests to complete before the load balancer shifts traffic away from a deregistered or unhealthy instance.
    • setConnectionDrainingPolicy

      @Stability(Stable) public void setConnectionDrainingPolicy(@Nullable IResolvable value)
      If enabled, the load balancer allows existing requests to complete before the load balancer shifts traffic away from a deregistered or unhealthy instance.
    • setConnectionDrainingPolicy

      @Stability(Stable) public void setConnectionDrainingPolicy(@Nullable CfnLoadBalancer.ConnectionDrainingPolicyProperty value)
      If enabled, the load balancer allows existing requests to complete before the load balancer shifts traffic away from a deregistered or unhealthy instance.
    • getConnectionSettings

      @Stability(Stable) @Nullable public Object getConnectionSettings()
      If enabled, the load balancer allows the connections to remain idle (no data is sent over the connection) for the specified duration.
    • setConnectionSettings

      @Stability(Stable) public void setConnectionSettings(@Nullable IResolvable value)
      If enabled, the load balancer allows the connections to remain idle (no data is sent over the connection) for the specified duration.
    • setConnectionSettings

      @Stability(Stable) public void setConnectionSettings(@Nullable CfnLoadBalancer.ConnectionSettingsProperty value)
      If enabled, the load balancer allows the connections to remain idle (no data is sent over the connection) for the specified duration.
    • getCrossZone

      @Stability(Stable) @Nullable public Object getCrossZone()
      If enabled, the load balancer routes the request traffic evenly across all instances regardless of the Availability Zones.
    • setCrossZone

      @Stability(Stable) public void setCrossZone(@Nullable Boolean value)
      If enabled, the load balancer routes the request traffic evenly across all instances regardless of the Availability Zones.
    • setCrossZone

      @Stability(Stable) public void setCrossZone(@Nullable IResolvable value)
      If enabled, the load balancer routes the request traffic evenly across all instances regardless of the Availability Zones.
    • getHealthCheck

      @Stability(Stable) @Nullable public Object getHealthCheck()
      The health check settings to use when evaluating the health of your EC2 instances.
    • setHealthCheck

      @Stability(Stable) public void setHealthCheck(@Nullable IResolvable value)
      The health check settings to use when evaluating the health of your EC2 instances.
    • setHealthCheck

      @Stability(Stable) public void setHealthCheck(@Nullable CfnLoadBalancer.HealthCheckProperty value)
      The health check settings to use when evaluating the health of your EC2 instances.
    • getInstances

      @Stability(Stable) @Nullable public List<String> getInstances()
      The IDs of the instances for the load balancer.
    • setInstances

      @Stability(Stable) public void setInstances(@Nullable List<String> value)
      The IDs of the instances for the load balancer.
    • getLbCookieStickinessPolicy

      @Stability(Stable) @Nullable public Object getLbCookieStickinessPolicy()
      Information about a policy for duration-based session stickiness.
    • setLbCookieStickinessPolicy

      @Stability(Stable) public void setLbCookieStickinessPolicy(@Nullable IResolvable value)
      Information about a policy for duration-based session stickiness.
    • setLbCookieStickinessPolicy

      @Stability(Stable) public void setLbCookieStickinessPolicy(@Nullable List<Object> value)
      Information about a policy for duration-based session stickiness.
    • getLoadBalancerName

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

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

      @Stability(Stable) @Nullable public Object getPolicies()
      The policies defined for your Classic Load Balancer.
    • setPolicies

      @Stability(Stable) public void setPolicies(@Nullable IResolvable value)
      The policies defined for your Classic Load Balancer.
    • setPolicies

      @Stability(Stable) public void setPolicies(@Nullable List<Object> value)
      The policies defined for your Classic Load Balancer.
    • getScheme

      @Stability(Stable) @Nullable public String getScheme()
      The type of load balancer.

      Valid only for load balancers in a VPC.

    • setScheme

      @Stability(Stable) public void setScheme(@Nullable String value)
      The type of load balancer.

      Valid only for load balancers in a VPC.

    • getSecurityGroups

      @Stability(Stable) @Nullable public List<String> getSecurityGroups()
      The security groups for the load balancer.
    • setSecurityGroups

      @Stability(Stable) public void setSecurityGroups(@Nullable List<String> value)
      The security groups for the load balancer.
    • getSubnets

      @Stability(Stable) @Nullable public List<String> getSubnets()
      The IDs of the subnets for the load balancer.

      You can specify at most one subnet per Availability Zone.

    • setSubnets

      @Stability(Stable) public void setSubnets(@Nullable List<String> value)
      The IDs of the subnets for the load balancer.

      You can specify at most one subnet per Availability Zone.

    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      The tags associated with a load balancer.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      The tags associated with a load balancer.