Interface INetworkLoadBalancerAttributes
Properties to reference an existing load balancer.
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface INetworkLoadBalancerAttributes
Syntax (vb)
Public Interface 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
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. |
LoadBalancerSecurityGroups | Security groups to associate with this load balancer. |
Vpc | The VPC to associate with the load balancer. |
Properties
LoadBalancerArn
ARN of the load balancer.
string LoadBalancerArn { get; }
Property Value
System.String
LoadBalancerCanonicalHostedZoneId
The canonical hosted zone ID of this load balancer.
virtual string LoadBalancerCanonicalHostedZoneId { get; }
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.
virtual string LoadBalancerDnsName { get; }
Property Value
System.String
Remarks
Default: - When not provided, LB cannot be used as Route53 Alias target.
LoadBalancerSecurityGroups
Security groups to associate with this load balancer.
virtual string[] LoadBalancerSecurityGroups { get; }
Property Value
System.String[]
Remarks
Default: - No security groups associated with the load balancer.
Vpc
The VPC to associate with the load balancer.
virtual IVpc Vpc { get; }
Property Value
Remarks
Default: - When not provided, listeners cannot be created on imported load balancers.