AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::ElasticLoadBalancingV2::Listener

The AWS::ElasticLoadBalancingV2::Listener resource creates a listener for an Application Load Balancer or a Network Load Balancer. The listener checks for connection requests and forwards them to one or more target groups. For more information, see Listeners for Your Application Load Balancers in the User Guide for Application Load Balancers or Listeners for Your Network Load Balancers in the User Guide for Network Load Balancers.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::ElasticLoadBalancingV2::Listener", "Properties" : { "Certificates" : [ Certificate ], "DefaultActions" : [ Action, ... ], "LoadBalancerArn" : String, "Port" : Integer, "Protocol" : String, "SslPolicy" : String } }

YAML

Type: AWS::ElasticLoadBalancingV2::Listener Properties: Certificates: - Certificate DefaultActions: - Action LoadBalancerArn: String Port: Integer Protocol: String SslPolicy: String

Properties

Certificates

[HTTPS and TLS listeners] The default SSL server certificate for the listener.

Required: Conditional. If you specify HTTPS or TLS for the Protocol property, you must specify exactly one certificate.

Type: List of Elastic Load Balancing V2 Certificate

Update requires: No interruption

DefaultActions

The actions for the default rule for the listener.

Required: Yes

Type: List of Elastic Load Balancing V2 Action

Update requires: No interruption

LoadBalancerArn

The Amazon Resource Name (ARN) of the load balancer.

Required: Yes

Type: String

Update requires: Replacement

Port

The port on which the listener listens for requests.

For valid values, see the Port parameter for the CreateListener action in the Elastic Load Balancing API Reference version 2015-12-01.

Required: Yes

Type: Integer

Update requires: No interruption

Protocol

The protocol that clients must use to send requests to the listener.

For valid values, see the Protocol parameter for the CreateListener action in the Elastic Load Balancing API Reference version 2015-12-01.

Required: Yes

Type: String

Update requires: No interruption

SslPolicy

[HTTPS and TLS listeners] The security policy that defines the ciphers and protocols that the listener supports. The default is the current predefined security policy.

Required: No

Type: String

Update requires: No interruption

Return Value

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the listener's ARN, such as arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2.

For more information about using the Ref function, see Ref.

Example

The following example creates a listener for the myLoadBalancer resource. The listener's default action is to forward requests to the myTargetGroup target group.

JSON

"Listener": { "Type": "AWS::ElasticLoadBalancingV2::Listener", "Properties": { "DefaultActions": [{ "Type": "forward", "TargetGroupArn": { "Ref": "myTargetGroup" } }], "LoadBalancerArn": { "Ref": "myLoadBalancer" }, "Port": "8000", "Protocol": "HTTP" } }

YAML

Listener: Type: AWS::ElasticLoadBalancingV2::Listener Properties: DefaultActions: - Type: forward TargetGroupArn: Ref: myTargetGroup LoadBalancerArn: Ref: myLoadBalancer Port: '8000' Protocol: HTTP