Class NetworkLoadBalancerAttributes
Properties to reference an existing load balancer.
Inheritance
System.Object
NetworkLoadBalancerAttributes
Implements
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.AWS.ElasticLoadBalancingV2.dll
Syntax (csharp)
public class NetworkLoadBalancerAttributes : Object, INetworkLoadBalancerAttributes
Syntax (vb)
Public Class NetworkLoadBalancerAttributes
Inherits Object
Implements INetworkLoadBalancerAttributes
Remarks
ExampleMetadata: infused
Examples
// Create an Accelerator
var accelerator = new Accelerator(this, "Accelerator");
// Create a Listener
var listener = accelerator.AddListener("Listener", new ListenerOptions {
PortRanges = new [] { new PortRange { FromPort = 80 }, new PortRange { FromPort = 443 } }
});
// Import the Load Balancers
var nlb1 = NetworkLoadBalancer.FromNetworkLoadBalancerAttributes(this, "NLB1", new NetworkLoadBalancerAttributes {
LoadBalancerArn = "arn:aws:elasticloadbalancing:us-west-2:111111111111:loadbalancer/app/my-load-balancer1/e16bef66805b"
});
var nlb2 = NetworkLoadBalancer.FromNetworkLoadBalancerAttributes(this, "NLB2", new NetworkLoadBalancerAttributes {
LoadBalancerArn = "arn:aws:elasticloadbalancing:ap-south-1:111111111111:loadbalancer/app/my-load-balancer2/5513dc2ea8a1"
});
// Add one EndpointGroup for each Region we are targeting
listener.AddEndpointGroup("Group1", new EndpointGroupOptions {
Endpoints = new [] { new NetworkLoadBalancerEndpoint(nlb1) }
});
listener.AddEndpointGroup("Group2", new EndpointGroupOptions {
// 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 = new [] { new NetworkLoadBalancerEndpoint(nlb2) }
});
Synopsis
Constructors
NetworkLoadBalancerAttributes() |
Properties
LoadBalancerArn | ARN of the load balancer. |
LoadBalancerCanonicalHostedZoneId | The canonical hosted zone ID of this load balancer. |
LoadBalancerDnsName | The DNS name of this load balancer. |
Vpc | The VPC to associate with the load balancer. |
Constructors
NetworkLoadBalancerAttributes()
public NetworkLoadBalancerAttributes()
Properties
LoadBalancerArn
ARN of the load balancer.
public string LoadBalancerArn { get; set; }
Property Value
System.String
LoadBalancerCanonicalHostedZoneId
The canonical hosted zone ID of this load balancer.
public string LoadBalancerCanonicalHostedZoneId { get; set; }
Property Value
System.String
Remarks
Default: - When not provided, LB cannot be used as Route53 Alias target.
LoadBalancerDnsName
The DNS name of this load balancer.
public string LoadBalancerDnsName { get; set; }
Property Value
System.String
Remarks
Default: - When not provided, LB cannot be used as Route53 Alias target.
Vpc
The VPC to associate with the load balancer.
public IVpc Vpc { get; set; }
Property Value
Remarks
Default: - When not provided, listeners cannot be created on imported load balancers.