listeners
Creates, updates, deletes or gets a listener resource or lists listeners in a region
Overview
| Name | listeners |
| Type | Resource |
| Description | Specifies a listener for an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. |
| Id | awscc.elasticloadbalancingv2.listeners |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
listener_arn | string | |
mutual_authentication | object | The mutual authentication configuration information. |
listener_attributes | array | The listener attributes. Attributes that you do not modify retain their current values. |
alpn_policy | array | [TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy. |
ssl_policy | string | [HTTPS and TLS listeners] The security policy that defines which protocols and ciphers are supported. For more information, see [Security policies](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html) in the *Application Load Balancers Guide* and [Security policies](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/describe-ssl-policies.html) in the *Network Load Balancers Guide*.<br />[HTTPS listeners] Updating the security policy can result in interruptions if the load balancer is handling a high volume of traffic. To decrease the possibility of an interruption if your load balancer is handling a high volume of traffic, create an additional load balancer or request an LCU reservation. |
load_balancer_arn | string | The Amazon Resource Name (ARN) of the load balancer. |
default_actions | array | The actions for the default rule. You cannot define a condition for a default rule.<br />To create additional rules for an Application Load Balancer, use [AWS::ElasticLoadBalancingV2::ListenerRule](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html). |
port | integer | The port on which the load balancer is listening. You can't specify a port for a Gateway Load Balancer. |
certificates | array | The default SSL server certificate for a secure listener. You must provide exactly one certificate if the listener protocol is HTTPS or TLS.<br />For an HTTPS listener, update requires some interruptions. For a TLS listener, update requires no interruption.<br />To create a certificate list for a secure listener, use [AWS::ElasticLoadBalancingV2::ListenerCertificate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenercertificate.html). |
protocol | string | The protocol for connections from clients to the load balancer. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You can't specify a protocol for a Gateway Load Balancer. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
listener_arn | string | |
region | string | AWS region. |
For more information, see AWS::ElasticLoadBalancingV2::Listener.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | listeners | INSERT | LoadBalancerArn, DefaultActions, region |
delete_resource | listeners | DELETE | Identifier, region |
update_resource | listeners | UPDATE | Identifier, PatchDocument, region |
list_resources | listeners_list_only | SELECT | region |
get_resource | listeners | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual listener.
SELECT
region,
listener_arn,
mutual_authentication,
listener_attributes,
alpn_policy,
ssl_policy,
load_balancer_arn,
default_actions,
port,
certificates,
protocol
FROM awscc.elasticloadbalancingv2.listeners
WHERE
region = 'us-east-1' AND
Identifier = '{{ listener_arn }}';
Lists all listeners in a region.
SELECT
region,
listener_arn
FROM awscc.elasticloadbalancingv2.listeners_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new listener resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.listeners (
LoadBalancerArn,
DefaultActions,
region
)
SELECT
'{{ load_balancer_arn }}',
'{{ default_actions }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.listeners (
MutualAuthentication,
ListenerAttributes,
AlpnPolicy,
SslPolicy,
LoadBalancerArn,
DefaultActions,
Port,
Certificates,
Protocol,
region
)
SELECT
'{{ mutual_authentication }}',
'{{ listener_attributes }}',
'{{ alpn_policy }}',
'{{ ssl_policy }}',
'{{ load_balancer_arn }}',
'{{ default_actions }}',
'{{ port }}',
'{{ certificates }}',
'{{ protocol }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: listener
props:
- name: mutual_authentication
value:
ignore_client_certificate_expiry: '{{ ignore_client_certificate_expiry }}'
mode: '{{ mode }}'
trust_store_arn: '{{ trust_store_arn }}'
advertise_trust_store_ca_names: '{{ advertise_trust_store_ca_names }}'
- name: listener_attributes
value:
- value: '{{ value }}'
key: '{{ key }}'
- name: alpn_policy
value:
- '{{ alpn_policy[0] }}'
- name: ssl_policy
value: '{{ ssl_policy }}'
- name: load_balancer_arn
value: '{{ load_balancer_arn }}'
- name: default_actions
value:
- order: '{{ order }}'
target_group_arn: '{{ target_group_arn }}'
fixed_response_config:
content_type: '{{ content_type }}'
status_code: '{{ status_code }}'
message_body: '{{ message_body }}'
authenticate_cognito_config:
on_unauthenticated_request: '{{ on_unauthenticated_request }}'
user_pool_client_id: '{{ user_pool_client_id }}'
user_pool_domain: '{{ user_pool_domain }}'
session_timeout: '{{ session_timeout }}'
scope: '{{ scope }}'
session_cookie_name: '{{ session_cookie_name }}'
user_pool_arn: '{{ user_pool_arn }}'
authentication_request_extra_params: {}
type: '{{ type }}'
redirect_config:
path: '{{ path }}'
query: '{{ query }}'
port: '{{ port }}'
host: '{{ host }}'
protocol: '{{ protocol }}'
status_code: '{{ status_code }}'
forward_config:
target_group_stickiness_config:
enabled: '{{ enabled }}'
duration_seconds: '{{ duration_seconds }}'
target_groups:
- target_group_arn: '{{ target_group_arn }}'
weight: '{{ weight }}'
authenticate_oidc_config:
on_unauthenticated_request: '{{ on_unauthenticated_request }}'
token_endpoint: '{{ token_endpoint }}'
use_existing_client_secret: '{{ use_existing_client_secret }}'
session_timeout: '{{ session_timeout }}'
scope: '{{ scope }}'
issuer: '{{ issuer }}'
client_secret: '{{ client_secret }}'
user_info_endpoint: '{{ user_info_endpoint }}'
client_id: '{{ client_id }}'
authorization_endpoint: '{{ authorization_endpoint }}'
session_cookie_name: '{{ session_cookie_name }}'
authentication_request_extra_params: {}
- name: port
value: '{{ port }}'
- name: certificates
value:
- certificate_arn: '{{ certificate_arn }}'
- name: protocol
value: '{{ protocol }}'
UPDATE example
Use the following StackQL query and manifest file to update a listener resource, using stack-deploy.
/*+ update */
UPDATE awscc.elasticloadbalancingv2.listeners
SET PatchDocument = string('{{ {
"MutualAuthentication": mutual_authentication,
"ListenerAttributes": listener_attributes,
"AlpnPolicy": alpn_policy,
"SslPolicy": ssl_policy,
"DefaultActions": default_actions,
"Port": port,
"Certificates": certificates,
"Protocol": protocol
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ listener_arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.elasticloadbalancingv2.listeners
WHERE
Identifier = '{{ listener_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the listeners resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
elasticloadbalancing:DescribeListeners,
elasticloadbalancing:DescribeListenerAttributes
elasticloadbalancing:CreateListener,
elasticloadbalancing:DescribeListeners,
cognito-idp:DescribeUserPoolClient,
elasticloadbalancing:ModifyListenerAttributes
elasticloadbalancing:ModifyListener,
elasticloadbalancing:DescribeListeners,
cognito-idp:DescribeUserPoolClient,
elasticloadbalancing:ModifyListenerAttributes
elasticloadbalancing:DescribeListeners
elasticloadbalancing:DeleteListener,
elasticloadbalancing:DescribeListeners