Interface NetworkLoadBalancerAttributes

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
NetworkLoadBalancerAttributes.Jsii$Proxy

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-10-31T19:12:58.170Z") @Stability(Stable) public interface NetworkLoadBalancerAttributes extends software.amazon.jsii.JsiiSerializable
Properties to reference an existing load balancer.

Example:

 // Create an Accelerator
 Accelerator accelerator = new Accelerator(this, "Accelerator");
 // Create a Listener
 Listener listener = accelerator.addListener("Listener", ListenerOptions.builder()
         .portRanges(List.of(PortRange.builder().fromPort(80).build(), PortRange.builder().fromPort(443).build()))
         .build());
 // Import the Load Balancers
 INetworkLoadBalancer nlb1 = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, "NLB1", NetworkLoadBalancerAttributes.builder()
         .loadBalancerArn("arn:aws:elasticloadbalancing:us-west-2:111111111111:loadbalancer/app/my-load-balancer1/e16bef66805b")
         .build());
 INetworkLoadBalancer nlb2 = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, "NLB2", NetworkLoadBalancerAttributes.builder()
         .loadBalancerArn("arn:aws:elasticloadbalancing:ap-south-1:111111111111:loadbalancer/app/my-load-balancer2/5513dc2ea8a1")
         .build());
 // Add one EndpointGroup for each Region we are targeting
 listener.addEndpointGroup("Group1", EndpointGroupOptions.builder()
         .endpoints(List.of(new NetworkLoadBalancerEndpoint(nlb1)))
         .build());
 listener.addEndpointGroup("Group2", EndpointGroupOptions.builder()
         // Imported load balancers automatically calculate their Region from the ARN.
         // If you are load balancing to other resources, you must also pass a `region`
         // parameter here.
         .endpoints(List.of(new NetworkLoadBalancerEndpoint(nlb2)))
         .build());
 
  • Method Details

    • getLoadBalancerArn

      @Stability(Stable) @NotNull String getLoadBalancerArn()
      ARN of the load balancer.
    • getLoadBalancerCanonicalHostedZoneId

      @Stability(Stable) @Nullable default String getLoadBalancerCanonicalHostedZoneId()
      The canonical hosted zone ID of this load balancer.

      Default: - When not provided, LB cannot be used as Route53 Alias target.

    • getLoadBalancerDnsName

      @Stability(Stable) @Nullable default String getLoadBalancerDnsName()
      The DNS name of this load balancer.

      Default: - When not provided, LB cannot be used as Route53 Alias target.

    • getLoadBalancerSecurityGroups

      @Stability(Stable) @Nullable default List<String> getLoadBalancerSecurityGroups()
      Security groups to associate with this load balancer.

      Default: - No security groups associated with the load balancer.

    • getVpc

      @Stability(Stable) @Nullable default IVpc getVpc()
      The VPC to associate with the load balancer.

      Default: - When not provided, listeners cannot be created on imported load balancers.

    • builder

      @Stability(Stable) static NetworkLoadBalancerAttributes.Builder builder()
      Returns:
      a NetworkLoadBalancerAttributes.Builder of NetworkLoadBalancerAttributes