java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.elasticloadbalancing.LoadBalancer
All Implemented Interfaces:
IConstruct, IDependable, IResource, IConnectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:40.176Z") @Stability(Stable) public class LoadBalancer extends Resource implements IConnectable
A load balancer with a single listener.

Routes to a fleet of of instances in a VPC.

Example:

 IVpc vpc;
 AutoScalingGroup myAutoScalingGroup;
 LoadBalancer lb = LoadBalancer.Builder.create(this, "LB")
         .vpc(vpc)
         .internetFacing(true)
         .healthCheck(HealthCheck.builder()
                 .port(80)
                 .build())
         .build();
 lb.addTarget(myAutoScalingGroup);
 lb.addListener(LoadBalancerListener.builder()
         .externalPort(80)
         .build());
 
  • Constructor Details

    • LoadBalancer

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

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

      @Stability(Stable) public LoadBalancer(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull LoadBalancerProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • addListener

      @Stability(Stable) @NotNull public ListenerPort addListener(@NotNull LoadBalancerListener listener)
      Add a backend to the load balancer.

      Parameters:
      listener - This parameter is required.
      Returns:
      A ListenerPort object that controls connections to the listener port
    • addTarget

      @Stability(Stable) public void addTarget(@NotNull ILoadBalancerTarget target)
      Parameters:
      target - This parameter is required.
    • getConnections

      @Stability(Stable) @NotNull public Connections getConnections()
      Control all connections from and to this load balancer.
      Specified by:
      getConnections in interface IConnectable
    • getListenerPorts

      @Stability(Stable) @NotNull public List<ListenerPort> getListenerPorts()
      An object controlling specifically the connections for each listener added to this load balancer.
    • getLoadBalancerCanonicalHostedZoneName

      @Stability(Stable) @NotNull public String getLoadBalancerCanonicalHostedZoneName()
    • getLoadBalancerCanonicalHostedZoneNameId

      @Stability(Stable) @NotNull public String getLoadBalancerCanonicalHostedZoneNameId()
    • getLoadBalancerDnsName

      @Stability(Stable) @NotNull public String getLoadBalancerDnsName()
    • getLoadBalancerName

      @Stability(Stable) @NotNull public String getLoadBalancerName()
    • getLoadBalancerSourceSecurityGroupGroupName

      @Stability(Stable) @NotNull public String getLoadBalancerSourceSecurityGroupGroupName()
    • getLoadBalancerSourceSecurityGroupOwnerAlias

      @Stability(Stable) @NotNull public String getLoadBalancerSourceSecurityGroupOwnerAlias()