Interface NetworkLoadBalancerAttributes
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
NetworkLoadBalancerAttributes.Jsii$Proxy
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-17T14:40:52.115Z")
@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());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forNetworkLoadBalancerAttributesstatic final classAn implementation forNetworkLoadBalancerAttributes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()ARN of the load balancer.default StringThe canonical hosted zone ID of this load balancer.default StringThe DNS name of this load balancer.Security groups to associate with this load balancer.default IVpcgetVpc()The VPC to associate with the load balancer.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getLoadBalancerArn
ARN of the load balancer. -
getLoadBalancerCanonicalHostedZoneId
The canonical hosted zone ID of this load balancer.Default: - When not provided, LB cannot be used as Route53 Alias target.
-
getLoadBalancerDnsName
The DNS name of this load balancer.Default: - When not provided, LB cannot be used as Route53 Alias target.
-
getLoadBalancerSecurityGroups
Security groups to associate with this load balancer.Default: - No security groups associated with the load balancer.
-
getVpc
The VPC to associate with the load balancer.Default: - When not provided, listeners cannot be created on imported load balancers.
-
builder
-