Skip to main content

rule_groups

Creates, updates, deletes or gets a rule_group resource or lists rule_groups in a region

Overview

Namerule_groups
TypeResource
DescriptionContains the Rules that identify the requests that you want to allow, block, or count. In a RuleGroup, you also specify a default action (ALLOW or BLOCK), and the action for each Rule that you add to a RuleGroup, for example, block requests from specified IP addresses or block requests from specified referrers. You also associate the RuleGroup with a CloudFront distribution to identify the requests that you want AWS WAF to filter. If you add more than one Rule to a RuleGroup, a request needs to match only one of the specifications to be allowed, blocked, or counted.
Idaws.wafv2.rule_groups

Fields

NameDatatypeDescription
arnstring
capacityinteger
descriptionstringDescription of the entity.
namestringName of the WebACL.
idstringId of the WebACL
scopestringUse CLOUDFRONT for CloudFront WebACL, use REGIONAL for Application Load Balancer and API Gateway.
rulesarrayCollection of Rules.
visibility_configobjectVisibility Metric of the WebACL.
tagsarray
label_namespacestringName of the Label.
custom_response_bodiesobjectCustom response key and body map.
available_labelsarrayCollection of Available Labels.
consumed_labelsarrayCollection of Consumed Labels.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTCapacity, Scope, VisibilityConfig, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all rule_groups in a region.

SELECT
region,
arn,
capacity,
description,
name,
id,
scope,
rules,
visibility_config,
tags,
label_namespace,
custom_response_bodies,
available_labels,
consumed_labels
FROM aws.wafv2.rule_groups
;

Gets all properties from an individual rule_group.

SELECT
region,
arn,
capacity,
description,
name,
id,
scope,
rules,
visibility_config,
tags,
label_namespace,
custom_response_bodies,
available_labels,
consumed_labels
FROM aws.wafv2.rule_groups
WHERE data__Identifier = '<Name>|<Id>|<Scope>';

INSERT example

Use the following StackQL query and manifest file to create a new rule_group resource, using stack-deploy.

/*+ create */
INSERT INTO aws.wafv2.rule_groups (
Capacity,
Scope,
VisibilityConfig,
region
)
SELECT
'{{ Capacity }}',
'{{ Scope }}',
'{{ VisibilityConfig }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.wafv2.rule_groups
WHERE data__Identifier = '<Name|Id|Scope>'
AND region = 'us-east-1';

Permissions

To operate on the rule_groups resource, the following permissions are required:

Create

wafv2:CreateRuleGroup,
wafv2:GetRuleGroup,
wafv2:ListTagsForResource

Delete

wafv2:DeleteRuleGroup,
wafv2:GetRuleGroup

Read

wafv2:GetRuleGroup,
wafv2:ListTagsForResource

Update

wafv2:UpdateRuleGroup,
wafv2:GetRuleGroup,
wafv2:ListTagsForResource

List

wafv2:listRuleGroups