Match rule statements - Amazon WAF, Amazon Firewall Manager, and Amazon Shield Advanced
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Match rule statements

Match statements compare the web request or its origin against criteria that you provide. For many statements of this type, Amazon WAF compares a specific component of the request for matching content.

Match statements are nestable. You can nest any of these statements inside logical rule statements and you can use them in scope-down statements. For information about logical rule statements, see Logical rule statements. For information about scope-down statements, see Scope-down statements.

This table describes the regular match statements that you can add to a rule and provides some guidelines for calculating web ACL capacity units (WCU) usage for each. For information about WCUs, see Amazon WAF web ACL capacity units (WCUs).

Match Statement

Description

WCUs

Geographic match

Inspects the request's country of origin and applies labels for the country and region of origin.

1

IP set match

Inspects the request against a set of IP addresses and address ranges.

1 for most cases. If you configure the statement to use a header with forwarded IP addresses and specify a position in the header of Any, then increase the WCUs by 4.

Label match rule statement

Inspects the request for labels that have been added by other rules in the same web ACL.

1

Regex match rule statement

Compares a regex pattern against a specified request component.

3, as a base cost.

If you use the request component All query parameters, add 10 WCUs. If you use the request component JSON body, double the base cost WCUs. For each Text transformation that you apply, add 10 WCUs.

Regex pattern set

Compares regex patterns against a specified request component.

25 per pattern set, as a base cost.

If you use the request component All query parameters, add 10 WCUs. If you use the request component JSON body, double the base cost WCUs. For each Text transformation that you apply, add 10 WCUs.

Size constraint

Checks size constraints against a specified request component.

1, as a base cost.

If you use the request component All query parameters, add 10 WCUs. If you use the request component JSON body, double the base cost WCUs. For each Text transformation that you apply, add 10 WCUs.

SQLi attack

Inspects for malicious SQL code in a specified request component.

20, as a base cost.

If you use the request component All query parameters, add 10 WCUs. If you use the request component JSON body, double the base cost WCUs. For each Text transformation that you apply, add 10 WCUs.

String match

Compares a string to a specified request component.

The base cost depends on the type of string match and is between 1 and 10.

If you use the request component All query parameters, add 10 WCUs. If you use the request component JSON body, double the base cost WCUs. For each Text transformation that you apply, add 10 WCUs.

XSS scripting attack

Inspects for cross-site scripting attacks in a specified request component.

40, as a base cost.

If you use the request component All query parameters, add 10 WCUs. If you use the request component JSON body, double the base cost WCUs. For each Text transformation that you apply, add 10 WCUs.