interface ListenerOptions
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.GlobalAccelerator.ListenerOptions |
![]() | software.amazon.awscdk.services.globalaccelerator.ListenerOptions |
![]() | aws_cdk.aws_globalaccelerator.ListenerOptions |
![]() | @aws-cdk/aws-globalaccelerator » ListenerOptions |
Construct options for Listener.
Example
// Create an Accelerator
const accelerator = new globalaccelerator.Accelerator(this, 'Accelerator');
// Create a Listener
const listener = accelerator.addListener('Listener', {
portRanges: [
{ fromPort: 80 },
{ fromPort: 443 },
],
});
// Import the Load Balancers
const nlb1 = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, 'NLB1', {
loadBalancerArn: 'arn:aws:elasticloadbalancing:us-west-2:111111111111:loadbalancer/app/my-load-balancer1/e16bef66805b',
});
const nlb2 = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, 'NLB2', {
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', {
endpoints: [new ga_endpoints.NetworkLoadBalancerEndpoint(nlb1)],
});
listener.addEndpointGroup('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: [new ga_endpoints.NetworkLoadBalancerEndpoint(nlb2)],
});
Properties
Name | Type | Description |
---|---|---|
port | Port [] | The list of port ranges for the connections from clients to the accelerator. |
client | Client | Client affinity to direct all requests from a user to the same endpoint. |
listener | string | Name of the listener. |
protocol? | Connection | The protocol for the connections from clients to the accelerator. |
portRanges
Type:
Port
[]
The list of port ranges for the connections from clients to the accelerator.
clientAffinity?
Type:
Client
(optional, default: ClientAffinity.NONE)
Client affinity to direct all requests from a user to the same endpoint.
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.
listenerName?
Type:
string
(optional, default: logical ID of the resource)
Name of the listener.
protocol?
Type:
Connection
(optional, default: ConnectionProtocol.TCP)
The protocol for the connections from clients to the accelerator.