Skip to main content

rules

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

Overview

Namerules
TypeResource
Idaws.elbv2.rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
actionsstringThe 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.
conditionsstringThe 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_defaultbooleanIndicates whether this is the default rule.
prioritystringThe priority.
rule_arnstringThe Amazon Resource Name (ARN) of the rule.
transformsstringThe transforms for the rule.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_rulesselectregionListenerArn, RuleArns, Marker, PageSizeDescribes the specified rules or the rules for the specified listener. You must specify either a listener or rules.
create_ruleinsertListenerArn, regionConditions, Priority, Actions, Tags, TransformsCreates 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_ruleupdateRuleArn, regionConditions, Actions, Transforms, ResetTransformsReplaces 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_prioritiesupdateRulePriorities, regionSets 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_ruledeleteRuleArn, regionDeletes 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.

NameDatatypeDescription
ListenerArnstringThe Amazon Resource Name (ARN) of the listener.
RuleArnstringThe Amazon Resource Name (ARN) of the rule.
RulePrioritiesarrayThe rule priorities.
regionstringAWS region (default: us-east-1)
ActionsarrayThe actions.
ConditionsarrayThe conditions.
ListenerArnstringThe Amazon Resource Name (ARN) of the listener.
MarkerstringThe marker for the next set of results. (You received this marker from a previous call.)
PageSizeintegerThe maximum number of results to return with this call.
PriorityintegerThe rule priority. A listener can't have multiple rules with the same priority.
ResetTransformsbooleanIndicates whether to remove all transforms from the rule. If you specify ResetTransforms, you can't specify Transforms.
RuleArnsarrayThe Amazon Resource Names (ARN) of the rules.
TagsarrayThe tags to assign to the rule.
TransformsarrayThe 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

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

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
;

UPDATE examples

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;

DELETE examples

Deletes the specified rule. You can't delete the default rule.

DELETE FROM aws.elbv2.rules
WHERE RuleArn = '{{ RuleArn }}' --required
AND region = '{{ region }}' --required
;