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 | aws.elasticloadbalancingv2.listener_rules |
Fields
| Name | Datatype | Description |
|---|---|---|
listener_arn | string | The Amazon Resource Name (ARN) of the listener. |
rule_arn | string | |
actions | array | The actions. 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. 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. |
conditions | array | The conditions. 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. |
is_default | boolean | |
region | string | AWS region. |
For more information, see AWS::ElasticLoadBalancingV2::ListenerRule.
Methods
| Name | Accessible by | Required Params |
|---|---|---|
create_resource | INSERT | Actions, Priority, Conditions, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT examples
Gets all listener_rules in a region.
SELECT
region,
listener_arn,
rule_arn,
actions,
priority,
conditions,
is_default
FROM aws.elasticloadbalancingv2.listener_rules
WHERE region = 'us-east-1';
Gets all properties from an individual listener_rule.
SELECT
region,
listener_arn,
rule_arn,
actions,
priority,
conditions,
is_default
FROM aws.elasticloadbalancingv2.listener_rules
WHERE region = 'us-east-1' AND data__Identifier = '<RuleArn>';
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 aws.elasticloadbalancingv2.listener_rules (
Actions,
Priority,
Conditions,
region
)
SELECT
'{{ Actions }}',
'{{ Priority }}',
'{{ Conditions }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.elasticloadbalancingv2.listener_rules (
ListenerArn,
Actions,
Priority,
Conditions,
region
)
SELECT
'{{ ListenerArn }}',
'{{ 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: ListenerArn
value: '{{ ListenerArn }}'
- name: Actions
value:
- Order: '{{ Order }}'
TargetGroupArn: '{{ TargetGroupArn }}'
FixedResponseConfig:
ContentType: '{{ ContentType }}'
StatusCode: '{{ StatusCode }}'
MessageBody: '{{ MessageBody }}'
AuthenticateCognitoConfig:
OnUnauthenticatedRequest: '{{ OnUnauthenticatedRequest }}'
UserPoolClientId: '{{ UserPoolClientId }}'
UserPoolDomain: '{{ UserPoolDomain }}'
SessionTimeout: '{{ SessionTimeout }}'
Scope: '{{ Scope }}'
SessionCookieName: '{{ SessionCookieName }}'
UserPoolArn: '{{ UserPoolArn }}'
AuthenticationRequestExtraParams: {}
Type: '{{ Type }}'
RedirectConfig:
Path: '{{ Path }}'
Query: '{{ Query }}'
Port: '{{ Port }}'
Host: '{{ Host }}'
Protocol: '{{ Protocol }}'
StatusCode: '{{ StatusCode }}'
ForwardConfig:
TargetGroupStickinessConfig:
Enabled: '{{ Enabled }}'
DurationSeconds: '{{ DurationSeconds }}'
TargetGroups:
- TargetGroupArn: '{{ TargetGroupArn }}'
Weight: '{{ Weight }}'
AuthenticateOidcConfig:
OnUnauthenticatedRequest: '{{ OnUnauthenticatedRequest }}'
TokenEndpoint: '{{ TokenEndpoint }}'
SessionTimeout: '{{ SessionTimeout }}'
Scope: '{{ Scope }}'
Issuer: '{{ Issuer }}'
ClientSecret: '{{ ClientSecret }}'
UserInfoEndpoint: '{{ UserInfoEndpoint }}'
ClientId: '{{ ClientId }}'
AuthorizationEndpoint: '{{ AuthorizationEndpoint }}'
SessionCookieName: '{{ SessionCookieName }}'
UseExistingClientSecret: '{{ UseExistingClientSecret }}'
AuthenticationRequestExtraParams: {}
- name: Priority
value: '{{ Priority }}'
- name: Conditions
value:
- Field: '{{ Field }}'
Values:
- '{{ Values[0] }}'
HttpRequestMethodConfig:
Values:
- '{{ Values[0] }}'
PathPatternConfig:
Values:
- '{{ Values[0] }}'
HttpHeaderConfig:
Values:
- '{{ Values[0] }}'
HttpHeaderName: '{{ HttpHeaderName }}'
SourceIpConfig:
Values:
- '{{ Values[0] }}'
HostHeaderConfig:
Values:
- '{{ Values[0] }}'
QueryStringConfig:
Values:
- Value: '{{ Value }}'
Key: '{{ Key }}'
DELETE example
/*+ delete */
DELETE FROM aws.elasticloadbalancingv2.listener_rules
WHERE data__Identifier = '<RuleArn>'
AND region = 'us-east-1';
Permissions
To operate on the listener_rules resource, the following permissions are required:
Create
elasticloadbalancing:CreateRule,
elasticloadbalancing:DescribeRules,
cognito-idp:DescribeUserPoolClient
Delete
elasticloadbalancing:DeleteRule,
elasticloadbalancing:DescribeRules
List
elasticloadbalancing:DescribeRules
Read
elasticloadbalancing:DescribeRules
Update
elasticloadbalancing:ModifyRule,
elasticloadbalancing:SetRulePriorities,
elasticloadbalancing:DescribeRules