NetworkListener

class aws_cdk.aws_elasticloadbalancingv2.NetworkListener(scope, id, *, load_balancer, port, certificates=None, default_target_groups=None, protocol=None, ssl_policy=None)

Bases: aws_cdk.aws_elasticloadbalancingv2.BaseListener

Define a Network Listener.

resource: :resource:: AWS::ElasticLoadBalancingV2::Listener

__init__(scope, id, *, load_balancer, port, certificates=None, default_target_groups=None, protocol=None, ssl_policy=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • props

  • load_balancer (INetworkLoadBalancer) – The load balancer to attach this listener to.

  • port (Union[int, float]) – The port on which the listener listens for requests.

  • certificates (Optional[List[INetworkListenerCertificateProps]]) – Certificate list of ACM cert ARNs. Default: - No certificates.

  • default_target_groups (Optional[List[INetworkTargetGroup]]) – Default target groups to load balance to. Default: - None.

  • protocol (Optional[Protocol]) – Protocol for listener, expects TCP or TLS. Default: - TLS if certificates are provided. TCP otherwise.

  • ssl_policy (Optional[SslPolicy]) – SSL Policy. Default: - Current predefined security policy.

Return type

None

Methods

add_target_groups(_id, *target_groups)

Load balance incoming requests to the given target groups.

Parameters
Return type

None

add_targets(id, *, port, deregistration_delay=None, health_check=None, proxy_protocol_v2=None, target_group_name=None, targets=None)

Load balance incoming requests to the given load balancing targets.

This method implicitly creates an ApplicationTargetGroup for the targets involved.

Parameters
  • id (str) –

  • props

  • port (Union[int, float]) – The port on which the listener listens for requests. Default: Determined from protocol if known

  • deregistration_delay (Optional[Duration]) – The amount of time for Elastic Load Balancing to wait before deregistering a target. The range is 0-3600 seconds. Default: Duration.minutes(5)

  • health_check (Optional[HealthCheck]) – Health check configuration. Default: No health check

  • proxy_protocol_v2 (Optional[bool]) – Indicates whether Proxy Protocol version 2 is enabled. Default: false

  • target_group_name (Optional[str]) – The name of the target group. This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. Default: Automatically generated

  • targets (Optional[List[INetworkLoadBalancerTarget]]) – The targets to add to this target group. Can be Instance, IPAddress, or any self-registering load balancing target. If you use either Instance or IPAddress as targets, all target must be of the same type.

return :rtype: NetworkTargetGroup :return: The newly created target group

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

listener_arn

attribute: :attribute:: true

Return type

str

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_network_listener_arn(scope, id, network_listener_arn)

Import an existing listener.

Parameters
  • scope (Construct) –

  • id (str) –

  • network_listener_arn (str) –

Return type

INetworkListener

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool