aws-cdk-lib.aws_elasticloadbalancingv2.NetworkListenerProps

interface NetworkListenerProps

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancingV2.NetworkListenerProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#NetworkListenerProps
Javasoftware.amazon.awscdk.services.elasticloadbalancingv2.NetworkListenerProps
Pythonaws_cdk.aws_elasticloadbalancingv2.NetworkListenerProps
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancingv2 » NetworkListenerProps

Properties for a Network Listener attached to a Load Balancer.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';

declare const listenerCertificate: elbv2.ListenerCertificate;
declare const networkListenerAction: elbv2.NetworkListenerAction;
declare const networkLoadBalancer: elbv2.NetworkLoadBalancer;
declare const networkTargetGroup: elbv2.NetworkTargetGroup;
const networkListenerProps: elbv2.NetworkListenerProps = {
  loadBalancer: networkLoadBalancer,
  port: 123,

  // the properties below are optional
  alpnPolicy: elbv2.AlpnPolicy.HTTP1_ONLY,
  certificates: [listenerCertificate],
  defaultAction: networkListenerAction,
  defaultTargetGroups: [networkTargetGroup],
  protocol: elbv2.Protocol.HTTP,
  sslPolicy: elbv2.SslPolicy.RECOMMENDED_TLS,
};

Properties

NameTypeDescription
loadBalancerINetworkLoadBalancerThe load balancer to attach this listener to.
portnumberThe port on which the listener listens for requests.
alpnPolicy?AlpnPolicyApplication-Layer Protocol Negotiation (ALPN) is a TLS extension that is sent on the initial TLS handshake hello messages.
certificates?IListenerCertificate[]Certificate list of ACM cert ARNs.
defaultAction?NetworkListenerActionDefault action to take for requests to this listener.
defaultTargetGroups?INetworkTargetGroup[]Default target groups to load balance to.
protocol?ProtocolProtocol for listener, expects TCP, TLS, UDP, or TCP_UDP.
sslPolicy?SslPolicySSL Policy.

loadBalancer

Type: INetworkLoadBalancer

The load balancer to attach this listener to.


port

Type: number

The port on which the listener listens for requests.


alpnPolicy?

Type: AlpnPolicy (optional, default: None)

Application-Layer Protocol Negotiation (ALPN) is a TLS extension that is sent on the initial TLS handshake hello messages.

ALPN enables the application layer to negotiate which protocols should be used over a secure connection, such as HTTP/1 and HTTP/2.

Can only be specified together with Protocol TLS.


certificates?

Type: IListenerCertificate[] (optional, default: No certificates.)

Certificate list of ACM cert ARNs.

You must provide exactly one certificate if the listener protocol is HTTPS or TLS.


defaultAction?

Type: NetworkListenerAction (optional, default: None.)

Default action to take for requests to this listener.

This allows full control of the default Action of the load balancer, including weighted forwarding. See the NetworkListenerAction class for all options.

Cannot be specified together with defaultTargetGroups.


defaultTargetGroups?

Type: INetworkTargetGroup[] (optional, default: None.)

Default target groups to load balance to.

All target groups will be load balanced to with equal weight and without stickiness. For a more complex configuration than that, use either defaultAction or addAction().

Cannot be specified together with defaultAction.


protocol?

Type: Protocol (optional, default: TLS if certificates are provided. TCP otherwise.)

Protocol for listener, expects TCP, TLS, UDP, or TCP_UDP.


sslPolicy?

Type: SslPolicy (optional, default: Current predefined security policy.)

SSL Policy.