Skip to main content

listeners

Creates, updates, deletes, gets or lists a listeners resource.

Overview​

Namelisteners
TypeResource
Idaws.vpc_lattice.listeners

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the listener. (pattern: <code>listener-[0-9a-z]{17}</code>)
namestringThe name of the listener. (pattern: <code>(?!listener-)(?![-])(?!.[-]$)(?!.[-]{2})[a-z0-9-]+</code>)
arnstringThe Amazon Resource Name (ARN) of the listener. (pattern: <code>arn:[a-z0-9-]+:vpc-lattice:[a-zA-Z0-9-]+:\d{12}:service/svc-[0-9a-z]{17}/listener/listener-[0-9a-z]{17}</code>)
created_atstring (date-time)The date and time that the listener was created, in ISO-8601 format.
default_actionobjectDescribes the action for a rule.
last_updated_atstring (date-time)The date and time that the listener was last updated, in ISO-8601 format.
portintegerThe listener port.
protocolstringThe listener protocol. (HTTP, HTTPS, TLS_PASSTHROUGH)
service_arnstringThe Amazon Resource Name (ARN) of the service. (pattern: <code>arn:[a-z0-9-]+:vpc-lattice:[a-zA-Z0-9-]+:\d{12}:service/svc-[0-9a-z]{17}</code>)
service_idstringThe ID of the service. (pattern: <code>svc-[0-9a-z]{17}</code>)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_listenerselectservice_identifier, listener_identifier, regionRetrieves information about the specified listener for the specified service.
list_listenersselectservice_identifier, regionmaxResults, nextTokenLists the listeners for the specified service.
create_listenerinsertservice_identifier, region, name, protocol, defaultActionCreates a listener for a service. Before you start using your Amazon VPC Lattice service, you must add one or more listeners. A listener is a process that checks for connection requests to your services. For more information, see Listeners in the Amazon VPC Lattice User Guide.
update_listenerupdateservice_identifier, listener_identifier, region, defaultActionUpdates the specified listener for the specified service.
delete_listenerdeleteservice_identifier, listener_identifier, regionDeletes the specified listener.
batch_update_ruleexecservice_identifier, listener_identifier, region, rulesUpdates the listener rules in a batch. You can use this operation to change the priority of listener rules. This can be useful when bulk updating or swapping rule priority. Required permissions: vpc-lattice:UpdateRule For more information, see How Amazon VPC Lattice works with IAM in the Amazon VPC Lattice User Guide.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
listener_identifierstringThe ID or ARN of the listener.
regionstringAWS region (default: us-east-1)
service_identifierstringThe ID or ARN of the service.
maxResultsintegerThe maximum number of results to return.
nextTokenstringA pagination token for the next page of results.

SELECT examples​

Retrieves information about the specified listener for the specified service.

SELECT
id,
name,
arn,
created_at,
default_action,
last_updated_at,
port,
protocol,
service_arn,
service_id
FROM aws.vpc_lattice.listeners
WHERE service_identifier = '{{ service_identifier }}' -- required
AND listener_identifier = '{{ listener_identifier }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples​

Creates a listener for a service. Before you start using your Amazon VPC Lattice service, you must add one or more listeners. A listener is a process that checks for connection requests to your services. For more information, see Listeners in the Amazon VPC Lattice User Guide.

INSERT INTO aws.vpc_lattice.listeners (
name,
protocol,
port,
defaultAction,
clientToken,
tags,
service_identifier,
region
)
SELECT
'{{ name }}' /* required */,
'{{ protocol }}' /* required */,
{{ port }},
'{{ defaultAction }}' /* required */,
'{{ clientToken }}',
'{{ tags }}',
'{{ service_identifier }}',
'{{ region }}'
RETURNING
id,
name,
arn,
default_action,
port,
protocol,
service_arn,
service_id
;

UPDATE examples​

Updates the specified listener for the specified service.

UPDATE aws.vpc_lattice.listeners
SET
defaultAction = '{{ defaultAction }}'
WHERE
service_identifier = '{{ service_identifier }}' --required
AND listener_identifier = '{{ listener_identifier }}' --required
AND region = '{{ region }}' --required
AND defaultAction = '{{ defaultAction }}' --required
RETURNING
id,
name,
arn,
default_action,
port,
protocol,
service_arn,
service_id;

DELETE examples​

Deletes the specified listener.

DELETE FROM aws.vpc_lattice.listeners
WHERE service_identifier = '{{ service_identifier }}' --required
AND listener_identifier = '{{ listener_identifier }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods​

Updates the listener rules in a batch. You can use this operation to change the priority of listener rules. This can be useful when bulk updating or swapping rule priority. Required permissions: vpc-lattice:UpdateRule For more information, see How Amazon VPC Lattice works with IAM in the Amazon VPC Lattice User Guide.

EXEC aws.vpc_lattice.listeners.batch_update_rule
@service_identifier='{{ service_identifier }}' --required,
@listener_identifier='{{ listener_identifier }}' --required,
@region='{{ region }}' --required
@@json=
'{
"rules": "{{ rules }}"
}'
;