rules
Creates, updates, deletes, gets or lists a rules resource.
Overview
| Name | rules |
| Type | Resource |
| Id | aws.elbv2.rules |
Fields
The following fields are returned by SELECT queries:
- describe_rules
| Name | Datatype | Description |
|---|---|---|
actions | string | The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed. |
conditions | string | The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string. |
is_default | boolean | Indicates whether this is the default rule. |
priority | string | The priority. |
rule_arn | string | The Amazon Resource Name (ARN) of the rule. |
transforms | string | The transforms for the rule. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_rules | select | region | ListenerArn, RuleArns, Marker, PageSize | Describes the specified rules or the rules for the specified listener. You must specify either a listener or rules. |
create_rule | insert | ListenerArn, region | Conditions, Priority, Actions, Tags, Transforms | Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer or a dual-stack Network Load Balancer. Each rule consists of a priority, one or more actions, and one or more conditions. Rules are evaluated in priority order, from the lowest value to the highest value. When the conditions for a rule are met, its actions are performed. If the conditions for no rules are met, the actions for the default rule are performed. For more information, see Listener rules in the Application Load Balancers Guide or Listener rules in the Network Load Balancers Guide. |
modify_rule | update | RuleArn, region | Conditions, Actions, Transforms, ResetTransforms | Replaces the specified properties of the specified rule. Any properties that you do not specify are unchanged. To add an item to a list, remove an item from a list, or update an item in a list, you must provide the entire list. For example, to add an action, specify a list with the current actions plus the new action. |
set_rule_priorities | update | RulePriorities, region | Sets the priorities of the specified rules. You can reorder the rules as long as there are no priority conflicts in the new order. Any existing rules that you do not specify retain their current priority. | |
delete_rule | delete | RuleArn, region | Deletes the specified rule. You can't delete the default rule. |
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.
| Name | Datatype | Description |
|---|---|---|
ListenerArn | string | The Amazon Resource Name (ARN) of the listener. |
RuleArn | string | The Amazon Resource Name (ARN) of the rule. |
RulePriorities | array | The rule priorities. |
region | string | AWS region (default: us-east-1) |
Actions | array | The actions. |
Conditions | array | The conditions. |
ListenerArn | string | The Amazon Resource Name (ARN) of the listener. |
Marker | string | The marker for the next set of results. (You received this marker from a previous call.) |
PageSize | integer | The maximum number of results to return with this call. |
Priority | integer | The rule priority. A listener can't have multiple rules with the same priority. |
ResetTransforms | boolean | Indicates whether to remove all transforms from the rule. If you specify ResetTransforms, you can't specify Transforms. |
RuleArns | array | The Amazon Resource Names (ARN) of the rules. |
Tags | array | The tags to assign to the rule. |
Transforms | array | The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify Transforms, you can't specify ResetTransforms. |
SELECT examples
- describe_rules
Describes the specified rules or the rules for the specified listener. You must specify either a listener or rules.
SELECT
actions,
conditions,
is_default,
priority,
rule_arn,
transforms
FROM aws.elbv2.rules
WHERE region = '{{ region }}' -- required
AND ListenerArn = '{{ ListenerArn }}'
AND RuleArns = '{{ RuleArns }}'
AND Marker = '{{ Marker }}'
AND PageSize = '{{ PageSize }}'
;
INSERT examples
- create_rule
- Manifest
Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer or a dual-stack Network Load Balancer. Each rule consists of a priority, one or more actions, and one or more conditions. Rules are evaluated in priority order, from the lowest value to the highest value. When the conditions for a rule are met, its actions are performed. If the conditions for no rules are met, the actions for the default rule are performed. For more information, see Listener rules in the Application Load Balancers Guide or Listener rules in the Network Load Balancers Guide.
INSERT INTO aws.elbv2.rules (
ListenerArn,
region,
Conditions,
Priority,
Actions,
Tags,
Transforms
)
SELECT
'{{ ListenerArn }}',
'{{ region }}',
'{{ Conditions }}',
'{{ Priority }}',
'{{ Actions }}',
'{{ Tags }}',
'{{ Transforms }}'
RETURNING
line_items
;
# Description fields are for documentation purposes
- name: rules
props:
- name: ListenerArn
value: "{{ ListenerArn }}"
description: Required parameter for the rules resource.
- name: region
value: "{{ region }}"
description: Required parameter for the rules resource.
- name: Conditions
value: "{{ Conditions }}"
description: The conditions.
description: The conditions.
- name: Priority
value: {{ Priority }}
description: The rule priority. A listener can't have multiple rules with the same priority.
description: The rule priority. A listener can't have multiple rules with the same priority.
- name: Actions
value: "{{ Actions }}"
description: The actions.
description: The actions.
- name: Tags
value: "{{ Tags }}"
description: The tags to assign to the rule.
description: The tags to assign to the rule.
- name: Transforms
value: "{{ Transforms }}"
description: The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.
description: The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.
UPDATE examples
- modify_rule
- set_rule_priorities
Replaces the specified properties of the specified rule. Any properties that you do not specify are unchanged. To add an item to a list, remove an item from a list, or update an item in a list, you must provide the entire list. For example, to add an action, specify a list with the current actions plus the new action.
UPDATE aws.elbv2.rules
SET
-- No updatable properties
WHERE
RuleArn = '{{ RuleArn }}' --required
AND region = '{{ region }}' --required
AND Conditions = '{{ Conditions}}'
AND Actions = '{{ Actions}}'
AND Transforms = '{{ Transforms}}'
AND ResetTransforms = {{ ResetTransforms}}
RETURNING
line_items;
Sets the priorities of the specified rules. You can reorder the rules as long as there are no priority conflicts in the new order. Any existing rules that you do not specify retain their current priority.
UPDATE aws.elbv2.rules
SET
-- No updatable properties
WHERE
RulePriorities = '{{ RulePriorities }}' --required
AND region = '{{ region }}' --required
RETURNING
line_items;
DELETE examples
- delete_rule
Deletes the specified rule. You can't delete the default rule.
DELETE FROM aws.elbv2.rules
WHERE RuleArn = '{{ RuleArn }}' --required
AND region = '{{ region }}' --required
;