- class aws_cdk.aws_globalaccelerator.Listener(scope, id, *, accelerator, port_ranges, client_affinity=None, listener_name=None, protocol=None)
The construct for the Listener.
# 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)] )
IAccelerator) – The accelerator for this listener.
Any]]]) – The list of port ranges for the connections from clients to the accelerator.
ClientAffinity]) – 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. Default: ClientAffinity.NONE
str]) – Name of the listener. Default: - logical ID of the resource
ConnectionProtocol]) – The protocol for the connections from clients to the accelerator. Default: ConnectionProtocol.TCP
- add_endpoint_group(id, *, endpoint_group_name=None, endpoints=None, health_check_interval=None, health_check_path=None, health_check_port=None, health_check_protocol=None, health_check_threshold=None, port_overrides=None, region=None, traffic_dial_percentage=None)
Add a new endpoint group to this listener.
str]) – Name of the endpoint group. Default: - logical ID of the resource
IEndpoint]]) – Initial list of endpoints for this group. Default: - Group is initially empty
Duration]) – The time between health checks for each endpoint. Must be either 10 or 30 seconds. Default: Duration.seconds(30)
str]) – The ping path for health checks (if the protocol is HTTP(S)). Default: ‘/’
None]) – The port used to perform health checks. Default: - The listener’s port
HealthCheckProtocol]) – The protocol used to perform health checks. Default: HealthCheckProtocol.TCP
None]) – The number of consecutive health checks required to set the state of a healthy endpoint to unhealthy, or to set an unhealthy endpoint to healthy. Default: 3
Any]]]]) – Override the destination ports used to route traffic to an endpoint. Unless overridden, the port used to hit the endpoint will be the same as the port that traffic arrives on at the listener. Default: - No overrides
str]) – The AWS Region where the endpoint group is located. Default: - region of the first endpoint in this group, or the stack region if that region can’t be determined
None]) – The percentage of traffic to send to this AWS Region. The percentage is applied to the traffic that would otherwise have been routed to the Region based on optimal routing. Additional traffic is distributed to other endpoint groups for this listener. Default: 100
- Return type:
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (
- Return type:
Returns a string representation of this construct.
- Return type:
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
The ARN of the listener.
The name of the listener.
The construct tree node associated with this construct.
The stack in which this resource is defined.
- classmethod from_listener_arn(scope, id, listener_arn)
import from ARN.
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Return type: