listener_rules
Creates, updates, deletes or gets a listener_rule resource or lists listener_rules in a region
Overview
| Name | listener_rules |
| Type | Resource |
| Description | Specifies a listener rule. The listener must be associated with an Application Load Balancer. Each rule consists of a priority, one or more actions, and one or more conditions. For more information, see [Quotas for your Application Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html) in the *User Guide for Application Load Balancers*. |
| Id | awscc.elasticloadbalancingv2.listener_rules |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
listener_arn | string | The Amazon Resource Name (ARN) of the listener. |
is_default | boolean | |
actions | array | The actions.<br />The rule must include exactly one of the following types of actions: ``forward``, ``fixed-response``, or ``redirect``, and it must be the last action to be performed. If the rule is for an HTTPS listener, it can also optionally include an authentication action. |
priority | integer | The rule priority. A listener can't have multiple rules with the same priority.<br />If you try to reorder rules by updating their priorities, do not specify a new priority if an existing rule already uses this priority, as this can cause an error. If you need to reuse a priority with a different rule, you must remove it as a priority first, and then specify it in a subsequent update. |
rule_arn | string | |
conditions | array | The conditions.<br />The rule can optionally include up to one of each of the following conditions: ``http-request-method``, ``host-header``, ``path-pattern``, and ``source-ip``. A rule can also optionally include one or more of each of the following conditions: ``http-header`` and ``query-string``. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
rule_arn | string | |
region | string | AWS region. |
For more information, see AWS::ElasticLoadBalancingV2::ListenerRule.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | listener_rules | INSERT | Actions, Priority, Conditions, region |
delete_resource | listener_rules | DELETE | Identifier, region |
update_resource | listener_rules | UPDATE | Identifier, PatchDocument, region |
list_resources | listener_rules_list_only | SELECT | region |
get_resource | listener_rules | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual listener_rule.
SELECT
region,
listener_arn,
is_default,
actions,
priority,
rule_arn,
conditions
FROM awscc.elasticloadbalancingv2.listener_rules
WHERE
region = 'us-east-1' AND
Identifier = '{{ rule_arn }}';
Lists all listener_rules in a region.
SELECT
region,
rule_arn
FROM awscc.elasticloadbalancingv2.listener_rules_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new listener_rule resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.listener_rules (
Actions,
Priority,
Conditions,
region
)
SELECT
'{{ actions }}',
'{{ priority }}',
'{{ conditions }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.listener_rules (
ListenerArn,
Actions,
Priority,
Conditions,
region
)
SELECT
'{{ listener_arn }}',
'{{ actions }}',
'{{ priority }}',
'{{ conditions }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: listener_rule
props:
- name: listener_arn
value: '{{ listener_arn }}'
- name: 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: priority
value: '{{ priority }}'
- name: conditions
value:
- field: '{{ field }}'
http_header_config:
values:
- '{{ values[0] }}'
http_header_name: '{{ http_header_name }}'
values: null
query_string_config:
values:
- value: '{{ value }}'
key: '{{ key }}'
host_header_config:
values: null
http_request_method_config:
values: null
path_pattern_config:
values: null
source_ip_config:
values:
- '{{ values[0] }}'
UPDATE example
Use the following StackQL query and manifest file to update a listener_rule resource, using stack-deploy.
/*+ update */
UPDATE awscc.elasticloadbalancingv2.listener_rules
SET PatchDocument = string('{{ {
"Actions": actions,
"Priority": priority,
"Conditions": conditions
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ rule_arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.elasticloadbalancingv2.listener_rules
WHERE
Identifier = '{{ rule_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the listener_rules resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
elasticloadbalancing:DescribeRules
elasticloadbalancing:CreateRule,
elasticloadbalancing:DescribeRules,
cognito-idp:DescribeUserPoolClient
elasticloadbalancing:ModifyRule,
elasticloadbalancing:SetRulePriorities,
elasticloadbalancing:DescribeRules
elasticloadbalancing:DescribeRules
elasticloadbalancing:DeleteRule,
elasticloadbalancing:DescribeRules