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

AWS::ElasticLoadBalancingV2::Listener

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

Syntax

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

JSON

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

YAML

Copy
Type: "AWS::ElasticLoadBalancingV2::Listener" Properties: Certificates: - Certificates DefaultActions: - DefaultActions LoadBalancerArn: String Port: Integer Protocol: String SslPolicy: String

Properties

Certificates

The SSL server certificate for the listener. With a certificate, you can encrypt traffic between the load balancer and the clients that initiate HTTPS sessions, and traffic between the load balancer and your targets.

Required: Conditional. If you specify HTTPS for the Protocol property, specify a certificate.

Type: List of Elastic Load Balancing Listener Certificates

Update requires: No interruption

DefaultActions

The default actions that the listener takes when handling incoming requests.

Required: Yes

Type: List of Elastic Load Balancing Listener DefaultActions

Update requires: No interruption

LoadBalancerArn

The Amazon Resource Name (ARN) of the load balancer to associate with the listener.

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

The security policy that defines the ciphers and protocols that the load balancer supports.

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

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

YAML

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