NetworkLoadBalancerEndpoint
- class aws_cdk.aws_globalaccelerator_endpoints.NetworkLoadBalancerEndpoint(load_balancer, *, preserve_client_ip=None, weight=None)
Bases:
object
Use a Network Load Balancer as a Global Accelerator Endpoint.
- ExampleMetadata:
infused
Example:
# Create an Accelerator accelerator = globalaccelerator.Accelerator(self, "Accelerator") # Create a Listener listener = accelerator.add_listener("Listener", port_ranges=[globalaccelerator.PortRange(from_port=80), globalaccelerator.PortRange(from_port=443) ] ) # Import the Load Balancers nlb1 = elbv2.NetworkLoadBalancer.from_network_load_balancer_attributes(self, "NLB1", load_balancer_arn="arn:aws:elasticloadbalancing:us-west-2:111111111111:loadbalancer/app/my-load-balancer1/e16bef66805b" ) nlb2 = elbv2.NetworkLoadBalancer.from_network_load_balancer_attributes(self, "NLB2", load_balancer_arn="arn:aws:elasticloadbalancing:ap-south-1:111111111111:loadbalancer/app/my-load-balancer2/5513dc2ea8a1" ) # Add one EndpointGroup for each Region we are targeting listener.add_endpoint_group("Group1", endpoints=[ga_endpoints.NetworkLoadBalancerEndpoint(nlb1)] ) listener.add_endpoint_group("Group2", # 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=[ga_endpoints.NetworkLoadBalancerEndpoint(nlb2)] )
- Parameters:
load_balancer (
INetworkLoadBalancer
) –preserve_client_ip (
Optional
[bool
]) – Forward the client IP address in anX-Forwarded-For
header. GlobalAccelerator will create Network Interfaces in your VPC in order to preserve the client IP address. Client IP address preservation is supported only in specific AWS Regions. See the GlobalAccelerator Developer Guide for a list. Default: falseweight (
Union
[int
,float
,None
]) – Endpoint weight across all endpoints in the group. Must be a value between 0 and 255. Default: 128
Methods
- render_endpoint_configuration()
Render the endpoint to an endpoint configuration.
- Return type:
Any
Attributes
- region
The region where the endpoint is located.
If the region cannot be determined,
undefined
is returned