Interface IListenerOptions
Construct options for Listener.
Namespace: Amazon.CDK.AWS.GlobalAccelerator
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IListenerOptions
Syntax (vb)
Public Interface IListenerOptions
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
ClientAffinity | Client affinity to direct all requests from a user to the same endpoint. |
ListenerName | Name of the listener. |
PortRanges | The list of port ranges for the connections from clients to the accelerator. |
Protocol | The protocol for the connections from clients to the accelerator. |
Properties
ClientAffinity
Client affinity to direct all requests from a user to the same endpoint.
virtual Nullable<ClientAffinity> ClientAffinity { get; }
Property Value
System.Nullable<ClientAffinity>
Remarks
If you have stateful applications, client affinity lets you direct all requests from a user to the same endpoint.
By default, each connection from each client is routed to seperate endpoints. Set client affinity to SOURCE_IP to route all connections from a single client to the same endpoint.
Default: ClientAffinity.NONE
ListenerName
Name of the listener.
virtual string ListenerName { get; }
Property Value
System.String
Remarks
Default: - logical ID of the resource
PortRanges
The list of port ranges for the connections from clients to the accelerator.
IPortRange[] PortRanges { get; }
Property Value
Protocol
The protocol for the connections from clients to the accelerator.
virtual Nullable<ConnectionProtocol> Protocol { get; }
Property Value
System.Nullable<ConnectionProtocol>
Remarks
Default: ConnectionProtocol.TCP