

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS WAF Regional
<a name="AWS_WAFRegional"></a>

**Resource types**
+ [AWS::WAFRegional::ByteMatchSet](aws-resource-wafregional-bytematchset.md)
+ [AWS::WAFRegional::GeoMatchSet](aws-resource-wafregional-geomatchset.md)
+ [AWS::WAFRegional::IPSet](aws-resource-wafregional-ipset.md)
+ [AWS::WAFRegional::RateBasedRule](aws-resource-wafregional-ratebasedrule.md)
+ [AWS::WAFRegional::RegexPatternSet](aws-resource-wafregional-regexpatternset.md)
+ [AWS::WAFRegional::Rule](aws-resource-wafregional-rule.md)
+ [AWS::WAFRegional::SizeConstraintSet](aws-resource-wafregional-sizeconstraintset.md)
+ [AWS::WAFRegional::SqlInjectionMatchSet](aws-resource-wafregional-sqlinjectionmatchset.md)
+ [AWS::WAFRegional::WebACL](aws-resource-wafregional-webacl.md)
+ [AWS::WAFRegional::WebACLAssociation](aws-resource-wafregional-webaclassociation.md)
+ [AWS::WAFRegional::XssMatchSet](aws-resource-wafregional-xssmatchset.md)

# AWS::WAFRegional::ByteMatchSet
<a name="aws-resource-wafregional-bytematchset"></a>

**Note**  
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

The `AWS::WAFRegional::ByteMatchSet` resource creates an AWS WAF`ByteMatchSet` that identifies a part of a web request that you want to inspect.

## Syntax
<a name="aws-resource-wafregional-bytematchset-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-bytematchset-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::ByteMatchSet",
  "Properties" : {
      "[ByteMatchTuples](#cfn-wafregional-bytematchset-bytematchtuples)" : [ ByteMatchTuple, ... ],
      "[Name](#cfn-wafregional-bytematchset-name)" : String
    }
}
```

### YAML
<a name="aws-resource-wafregional-bytematchset-syntax.yaml"></a>

```
Type: AWS::WAFRegional::ByteMatchSet
Properties:
  [ByteMatchTuples](#cfn-wafregional-bytematchset-bytematchtuples): 
    - ByteMatchTuple
  [Name](#cfn-wafregional-bytematchset-name): String
```

## Properties
<a name="aws-resource-wafregional-bytematchset-properties"></a>

`ByteMatchTuples`  <a name="cfn-wafregional-bytematchset-bytematchtuples"></a>
Specifies the bytes (typically a string that corresponds with ASCII characters) that you want AWS WAF to search for in web requests, the location in requests that you want AWS WAF to search, and other settings.  
*Required*: No  
*Type*: Array of [ByteMatchTuple](aws-properties-wafregional-bytematchset-bytematchtuple.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Name`  <a name="cfn-wafregional-bytematchset-name"></a>
A friendly name or description of the `ByteMatchSet`. You can't change `Name` after you create a `ByteMatchSet`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-wafregional-bytematchset-return-values"></a>

### Ref
<a name="aws-resource-wafregional-bytematchset-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-bytematchset-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-bytematchset--examples"></a>



**Topics**
+ [HTTP Referers](#aws-resource-wafregional-bytematchset--examples--HTTP_Referers)
+ [Associate a ByteMatchSet with a Web ACL Rule](#aws-resource-wafregional-bytematchset--examples--Associate_a_ByteMatchSet_with_a_Web_ACL_Rule)
+ [Create a Web ACL](#aws-resource-wafregional-bytematchset--examples--Create_a_Web_ACL)

### HTTP Referers
<a name="aws-resource-wafregional-bytematchset--examples--HTTP_Referers"></a>

The following example defines a set of HTTP referers to match.

#### JSON
<a name="aws-resource-wafregional-bytematchset--examples--HTTP_Referers--json"></a>

```
"BadReferers": {
  "Type": "AWS::WAFRegional::ByteMatchSet",
  "Properties": {
    "Name": "ByteMatch for matching bad HTTP referers",
    "ByteMatchTuples": [
      {
        "FieldToMatch" : {
          "Type": "HEADER",
          "Data": "referer"
        },
        "TargetString" : "badrefer1",
        "TextTransformation" : "NONE",
        "PositionalConstraint" : "CONTAINS"
      },
      {
        "FieldToMatch" : {
          "Type": "HEADER",
          "Data": "referer"
        },
        "TargetString" : "badrefer2",
        "TextTransformation" : "NONE",
        "PositionalConstraint" : "CONTAINS"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-bytematchset--examples--HTTP_Referers--yaml"></a>

```
BadReferers: 
  Type: "AWS::WAFRegional::ByteMatchSet"
  Properties: 
    Name: "ByteMatch for matching bad HTTP referers"
    ByteMatchTuples: 
      - 
        FieldToMatch: 
          Type: "HEADER"
          Data: "referer"
        TargetString: "badrefer1"
        TextTransformation: "NONE"
        PositionalConstraint: "CONTAINS"
      - 
        FieldToMatch: 
          Type: "HEADER"
          Data: "referer"
        TargetString: "badrefer2"
        TextTransformation: "NONE"
        PositionalConstraint: "CONTAINS"
```

### Associate a ByteMatchSet with a Web ACL Rule
<a name="aws-resource-wafregional-bytematchset--examples--Associate_a_ByteMatchSet_with_a_Web_ACL_Rule"></a>

The following example associates the `BadReferers` byte match set with a web access control list (ACL) rule.

#### JSON
<a name="aws-resource-wafregional-bytematchset--examples--Associate_a_ByteMatchSet_with_a_Web_ACL_Rule--json"></a>

```
"BadReferersRule" : {
  "Type": "AWS::WAFRegional::Rule",
  "Properties": {
    "Name": "BadReferersRule",
    "MetricName" : "BadReferersRule",
    "Predicates": [
      {
        "DataId" : {  "Ref" : "BadReferers" },
        "Negated" : false,
        "Type" : "ByteMatch"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-bytematchset--examples--Associate_a_ByteMatchSet_with_a_Web_ACL_Rule--yaml"></a>

```
BadReferersRule: 
  Type: "AWS::WAFRegional::Rule"
  Properties: 
    Name: "BadReferersRule"
    MetricName: "BadReferersRule"
    Predicates: 
      - 
        DataId: 
          Ref: "BadReferers"
        Negated: false
        Type: "ByteMatch"
```

### Create a Web ACL
<a name="aws-resource-wafregional-bytematchset--examples--Create_a_Web_ACL"></a>

The following example associates the `BadReferersRule` rule with a web ACL. The web ACL allows all requests except for ones with referers that match the `BadReferersRule` rule.

#### JSON
<a name="aws-resource-wafregional-bytematchset--examples--Create_a_Web_ACL--json"></a>

```
"MyWebACL": {
  "Type": "AWS::WAFRegional::WebACL",
  "Properties": {
    "Name": "WebACL to block blacklisted IP addresses",
    "DefaultAction": {
      "Type": "ALLOW"
    },
    "MetricName" : "MyWebACL",
    "Rules": [
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 1,
        "RuleId" : { "Ref" : "BadReferersRule" }
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-bytematchset--examples--Create_a_Web_ACL--yaml"></a>

```
MyWebACL: 
  Type: "AWS::WAFRegional::WebACL"
  Properties: 
    Name: "WebACL to block blacklisted IP addresses"
    DefaultAction: 
      Type: "ALLOW"
    MetricName: "MyWebACL"
    Rules: 
      - 
        Action: 
          Type: "BLOCK"
        Priority: 1
        RuleId: 
          Ref: "BadReferersRule"
```

# AWS::WAFRegional::ByteMatchSet ByteMatchTuple
<a name="aws-properties-wafregional-bytematchset-bytematchtuple"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

The bytes (typically a string that corresponds with ASCII characters) that you want AWS WAF to search for in web requests, the location in requests that you want AWS WAF to search, and other settings.

## Syntax
<a name="aws-properties-wafregional-bytematchset-bytematchtuple-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-bytematchset-bytematchtuple-syntax.json"></a>

```
{
  "[FieldToMatch](#cfn-wafregional-bytematchset-bytematchtuple-fieldtomatch)" : FieldToMatch,
  "[PositionalConstraint](#cfn-wafregional-bytematchset-bytematchtuple-positionalconstraint)" : String,
  "[TargetString](#cfn-wafregional-bytematchset-bytematchtuple-targetstring)" : String,
  "[TargetStringBase64](#cfn-wafregional-bytematchset-bytematchtuple-targetstringbase64)" : String,
  "[TextTransformation](#cfn-wafregional-bytematchset-bytematchtuple-texttransformation)" : String
}
```

### YAML
<a name="aws-properties-wafregional-bytematchset-bytematchtuple-syntax.yaml"></a>

```
  [FieldToMatch](#cfn-wafregional-bytematchset-bytematchtuple-fieldtomatch): 
    FieldToMatch
  [PositionalConstraint](#cfn-wafregional-bytematchset-bytematchtuple-positionalconstraint): String
  [TargetString](#cfn-wafregional-bytematchset-bytematchtuple-targetstring): 
    String
  [TargetStringBase64](#cfn-wafregional-bytematchset-bytematchtuple-targetstringbase64): 
    String
  [TextTransformation](#cfn-wafregional-bytematchset-bytematchtuple-texttransformation): String
```

## Properties
<a name="aws-properties-wafregional-bytematchset-bytematchtuple-properties"></a>

`FieldToMatch`  <a name="cfn-wafregional-bytematchset-bytematchtuple-fieldtomatch"></a>
The part of a web request that you want AWS WAF to inspect, such as a specific header or a query string.   
*Required*: Yes  
*Type*: [FieldToMatch](aws-properties-wafregional-bytematchset-fieldtomatch.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`PositionalConstraint`  <a name="cfn-wafregional-bytematchset-bytematchtuple-positionalconstraint"></a>
Within the portion of a web request that you want to search (for example, in the query string, if any), specify where you want AWS WAF to search. Valid values include the following:  
 **CONTAINS**   
The specified part of the web request must include the value of `TargetString`, but the location doesn't matter.  
 **CONTAINS\$1WORD**   
The specified part of the web request must include the value of `TargetString`, and `TargetString` must contain only alphanumeric characters or underscore (A-Z, a-z, 0-9, or \$1). In addition, `TargetString` must be a word, which means one of the following:  
+ `TargetString` exactly matches the value of the specified part of the web request, such as the value of a header.
+ `TargetString` is at the beginning of the specified part of the web request and is followed by a character other than an alphanumeric character or underscore (\$1), for example, `BadBot;`.
+ `TargetString` is at the end of the specified part of the web request and is preceded by a character other than an alphanumeric character or underscore (\$1), for example, `;BadBot`.
+ `TargetString` is in the middle of the specified part of the web request and is preceded and followed by characters other than alphanumeric characters or underscore (\$1), for example, `-BadBot;`.
 **EXACTLY**   
The value of the specified part of the web request must exactly match the value of `TargetString`.  
 **STARTS\$1WITH**   
The value of `TargetString` must appear at the beginning of the specified part of the web request.  
 **ENDS\$1WITH**   
The value of `TargetString` must appear at the end of the specified part of the web request.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `EXACTLY | STARTS_WITH | ENDS_WITH | CONTAINS | CONTAINS_WORD`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TargetString`  <a name="cfn-wafregional-bytematchset-bytematchtuple-targetstring"></a>
The value that you want AWS WAF to search for. AWS WAF searches for the specified string in the part of web requests that you specified in `FieldToMatch`. The maximum length of the value is 50 bytes.  
You must specify this property or the `TargetStringBase64` property.   
Valid values depend on the values that you specified for `FieldToMatch`:  
+ `HEADER`: The value that you want AWS WAF to search for in the request header that you specified in `FieldToMatch`, for example, the value of the `User-Agent` or `Referer` header.
+ `METHOD`: The HTTP method, which indicates the type of operation specified in the request. 
+ `QUERY_STRING`: The value that you want AWS WAF to search for in the query string, which is the part of a URL that appears after a `?` character.
+ `URI`: The value that you want AWS WAF to search for in the part of a URL that identifies a resource, for example, `/images/daily-ad.jpg`.
+ `BODY`: The part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form. The request body immediately follows the request headers. Note that only the first `8192` bytes of the request body are forwarded to AWS WAF for inspection. To allow or block requests based on the length of the body, you can create a size constraint set. 
+ `SINGLE_QUERY_ARG`: The parameter in the query string that you will inspect, such as *UserName* or *SalesRegion*. The maximum length for `SINGLE_QUERY_ARG` is 30 characters.
+ `ALL_QUERY_ARGS`: Similar to `SINGLE_QUERY_ARG`, but instead of inspecting a single parameter, AWS WAF inspects all parameters within the query string for the value or regex pattern that you specify in `TargetString`.
If `TargetString` includes alphabetic characters A-Z and a-z, note that the value is case sensitive.  
*Required*: Conditional  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TargetStringBase64`  <a name="cfn-wafregional-bytematchset-bytematchtuple-targetstringbase64"></a>
The base64-encoded value that AWS WAF searches for. AWS CloudFormation sends this value to AWS WAF without encoding it.  
You must specify this property or the `TargetString` property.  
AWS WAF searches for this value in a specific part of web requests, which you define in the `FieldToMatch` property.  
Valid values depend on the Type value in the `FieldToMatch` property. For example, for a `METHOD` type, you must specify HTTP methods such as `DELETE, GET, HEAD, OPTIONS, PATCH, POST`, and `PUT`.   
*Required*: Conditional  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TextTransformation`  <a name="cfn-wafregional-bytematchset-bytematchtuple-texttransformation"></a>
Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on `FieldToMatch` before inspecting it for a match.  
You can only specify a single type of TextTransformation.  
 **CMD\$1LINE**   
When you're concerned that attackers are injecting an operating system command line command and using unusual formatting to disguise some or all of the command, use this option to perform the following transformations:  
+ Delete the following characters: \$1 " ' ^
+ Delete spaces before the following characters: / (
+ Replace the following characters with a space: , ;
+ Replace multiple spaces with one space
+ Convert uppercase letters (A-Z) to lowercase (a-z)
 **COMPRESS\$1WHITE\$1SPACE**   
Use this option to replace the following characters with a space character (decimal 32):  
+ \$1f, formfeed, decimal 12
+ \$1t, tab, decimal 9
+ \$1n, newline, decimal 10
+ \$1r, carriage return, decimal 13
+ \$1v, vertical tab, decimal 11
+ non-breaking space, decimal 160
`COMPRESS_WHITE_SPACE` also replaces multiple spaces with one space.  
 **HTML\$1ENTITY\$1DECODE**   
Use this option to replace HTML-encoded characters with unencoded characters. `HTML_ENTITY_DECODE` performs the following operations:  
+ Replaces `(ampersand)quot;` with `"`
+ Replaces `(ampersand)nbsp;` with a non-breaking space, decimal 160
+ Replaces `(ampersand)lt;` with a "less than" symbol
+ Replaces `(ampersand)gt;` with `>`
+ Replaces characters that are represented in hexadecimal format, `(ampersand)#xhhhh;`, with the corresponding characters
+ Replaces characters that are represented in decimal format, `(ampersand)#nnnn;`, with the corresponding characters
 **LOWERCASE**   
Use this option to convert uppercase letters (A-Z) to lowercase (a-z).  
 **URL\$1DECODE**   
Use this option to decode a URL-encoded value.  
 **NONE**   
Specify `NONE` if you don't want to perform any text transformations.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `NONE | COMPRESS_WHITE_SPACE | HTML_ENTITY_DECODE | LOWERCASE | CMD_LINE | URL_DECODE`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::ByteMatchSet FieldToMatch
<a name="aws-properties-wafregional-bytematchset-fieldtomatch"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Specifies where in a web request to look for `TargetString`.

## Syntax
<a name="aws-properties-wafregional-bytematchset-fieldtomatch-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-bytematchset-fieldtomatch-syntax.json"></a>

```
{
  "[Data](#cfn-wafregional-bytematchset-fieldtomatch-data)" : String,
  "[Type](#cfn-wafregional-bytematchset-fieldtomatch-type)" : String
}
```

### YAML
<a name="aws-properties-wafregional-bytematchset-fieldtomatch-syntax.yaml"></a>

```
  [Data](#cfn-wafregional-bytematchset-fieldtomatch-data): String
  [Type](#cfn-wafregional-bytematchset-fieldtomatch-type): String
```

## Properties
<a name="aws-properties-wafregional-bytematchset-fieldtomatch-properties"></a>

`Data`  <a name="cfn-wafregional-bytematchset-fieldtomatch-data"></a>
When the value of `Type` is `HEADER`, enter the name of the header that you want AWS WAF to search, for example, `User-Agent` or `Referer`. The name of the header is not case sensitive.  
When the value of `Type` is `SINGLE_QUERY_ARG`, enter the name of the parameter that you want AWS WAF to search, for example, `UserName` or `SalesRegion`. The parameter name is not case sensitive.  
If the value of `Type` is any other value, omit `Data`.  
*Required*: No  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-wafregional-bytematchset-fieldtomatch-type"></a>
The part of the web request that you want AWS WAF to search for a specified string. Parts of a request that you can search include the following:  
+ `HEADER`: A specified request header, for example, the value of the `User-Agent` or `Referer` header. If you choose `HEADER` for the type, specify the name of the header in `Data`.
+ `METHOD`: The HTTP method, which indicated the type of operation that the request is asking the origin to perform. 
+ `QUERY_STRING`: A query string, which is the part of a URL that appears after a `?` character, if any.
+ `URI`: The part of a web request that identifies a resource, for example, `/images/daily-ad.jpg`.
+ `BODY`: The part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form. The request body immediately follows the request headers. Note that only the first `8192` bytes of the request body are forwarded to AWS WAF for inspection. To allow or block requests based on the length of the body, you can create a size constraint set.
+ `SINGLE_QUERY_ARG`: The parameter in the query string that you will inspect, such as *UserName* or *SalesRegion*. The maximum length for `SINGLE_QUERY_ARG` is 30 characters.
+ `ALL_QUERY_ARGS`: Similar to `SINGLE_QUERY_ARG`, but rather than inspecting a single parameter, AWS WAF will inspect all parameters within the query for the value or regex pattern that you specify in `TargetString`.
*Required*: Yes  
*Type*: String  
*Allowed values*: `URI | QUERY_STRING | HEADER | METHOD | BODY | SINGLE_QUERY_ARG | ALL_QUERY_ARGS`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::GeoMatchSet
<a name="aws-resource-wafregional-geomatchset"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Contains one or more countries that AWS WAF will search for.

## Syntax
<a name="aws-resource-wafregional-geomatchset-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-geomatchset-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::GeoMatchSet",
  "Properties" : {
      "[GeoMatchConstraints](#cfn-wafregional-geomatchset-geomatchconstraints)" : [ GeoMatchConstraint, ... ],
      "[Name](#cfn-wafregional-geomatchset-name)" : String
    }
}
```

### YAML
<a name="aws-resource-wafregional-geomatchset-syntax.yaml"></a>

```
Type: AWS::WAFRegional::GeoMatchSet
Properties:
  [GeoMatchConstraints](#cfn-wafregional-geomatchset-geomatchconstraints): 
    - GeoMatchConstraint
  [Name](#cfn-wafregional-geomatchset-name): String
```

## Properties
<a name="aws-resource-wafregional-geomatchset-properties"></a>

`GeoMatchConstraints`  <a name="cfn-wafregional-geomatchset-geomatchconstraints"></a>
An array of `GeoMatchConstraint` objects, which contain the country that you want AWS WAF to search for.  
*Required*: No  
*Type*: Array of [GeoMatchConstraint](aws-properties-wafregional-geomatchset-geomatchconstraint.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Name`  <a name="cfn-wafregional-geomatchset-name"></a>
A friendly name or description of the [AWS::WAFRegional::GeoMatchSet](#aws-resource-wafregional-geomatchset). You can't change the name of an `GeoMatchSet` after you create it.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-wafregional-geomatchset-return-values"></a>

### Ref
<a name="aws-resource-wafregional-geomatchset-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-geomatchset-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-geomatchset--examples"></a>



**Topics**
+ [Define Geographic Constraints](#aws-resource-wafregional-geomatchset--examples--Define_Geographic_Constraints)
+ [Associate a GeoMatchSet with a Web ACL Rule](#aws-resource-wafregional-geomatchset--examples--Associate_a_GeoMatchSet_with_a_Web_ACL_Rule)
+ [Create a Web ACL](#aws-resource-wafregional-geomatchset--examples--Create_a_Web_ACL)

### Define Geographic Constraints
<a name="aws-resource-wafregional-geomatchset--examples--Define_Geographic_Constraints"></a>

The following example defines a set of GeoMatchConstraints for a web access control list (ACL) rule.

#### JSON
<a name="aws-resource-wafregional-geomatchset--examples--Define_Geographic_Constraints--json"></a>

```
"MyGeoConstraints": {
  "Type": "AWS::WAFRegional::GeoMatchSet",
  "Properties": {
    "Name": "GeoMatchSet for restricted countries",
    "GeoMatchConstraints": [
      {
        "Type" : "Country",
        "Value" : "AE"
      },
      {
        "Type" : "Country",
        "Value" : "ZW"
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-geomatchset--examples--Define_Geographic_Constraints--yaml"></a>

```
MyGeoConstraints: 
  Type: "AWS::WAFRegional::GeoMatchSet"
  Properties: 
    Name: "GeoMatchSet for restricted countries"
    GeoMatchConstraints: 
      - 
        Type: "Country"
        Value: "AE"
      - 
        Type: "Country"
        Value: "AE"
```

### Associate a GeoMatchSet with a Web ACL Rule
<a name="aws-resource-wafregional-geomatchset--examples--Associate_a_GeoMatchSet_with_a_Web_ACL_Rule"></a>

The following example associates the `MyGeoConstraints` with a web ACL rule.

#### JSON
<a name="aws-resource-wafregional-geomatchset--examples--Associate_a_GeoMatchSet_with_a_Web_ACL_Rule--json"></a>

```
"MyGeoMatchRule" : {
  "Type": "AWS::WAFRegional::Rule",
  "Properties": {
    "Name": "MyGeoMatchRule",
    "MetricName" : "MyGeoMatchRule",
    "Predicates": [
      {
        "DataId" : {  "Ref" : "MyGeoConstraints" },
        "Negated" : false,
        "Type" : "GeoMatch"
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-geomatchset--examples--Associate_a_GeoMatchSet_with_a_Web_ACL_Rule--yaml"></a>

```
MyGeoMatchRule: 
  Type: "AWS::WAFRegional::Rule"
  Properties: 
    Name: "MyGeoMatchRule"
    MetricName: "MyGeoMatchRule"
    Predicates: 
      - 
        DataId: 
          Ref: "MyGeoConstraints"
        Negated: false
        Type: "GeoMatch"
```

### Create a Web ACL
<a name="aws-resource-wafregional-geomatchset--examples--Create_a_Web_ACL"></a>

The following example associates the `MyGeoMatchRule` rule with a web ACL. The web ACL allows requests that originate from all countries except for those that are defined in the `MyGeoMatchRule`.

#### JSON
<a name="aws-resource-wafregional-geomatchset--examples--Create_a_Web_ACL--json"></a>

```
"MyWebACL": {
  "Type": "AWS::WAFRegional::WebACL",
  "Properties": {
    "Name": "WebACL to block restricted countries",
    "DefaultAction": {
      "Type": "ALLOW"
    },
    "MetricName" : "MyWebACL",
    "Rules": [
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 1,
        "RuleId" : { "Ref" : "MyGeoMatchRule" }
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-geomatchset--examples--Create_a_Web_ACL--yaml"></a>

```
MyWebACL: 
  Type: "AWS::WAFRegional::WebACL"
  Properties: 
    Name: "WebACL to block restricted countries"
    DefaultAction: 
      Type: "ALLOW"
    MetricName: "MyWebACL"
    Rules: 
      - 
        Action: 
          Type: "BLOCK"
        Priority: 1
        RuleId: 
          Ref: "MyGeoMatchRule"
```

# AWS::WAFRegional::GeoMatchSet GeoMatchConstraint
<a name="aws-properties-wafregional-geomatchset-geomatchconstraint"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

The country from which web requests originate that you want AWS WAF to search for.

## Syntax
<a name="aws-properties-wafregional-geomatchset-geomatchconstraint-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-geomatchset-geomatchconstraint-syntax.json"></a>

```
{
  "[Type](#cfn-wafregional-geomatchset-geomatchconstraint-type)" : String,
  "[Value](#cfn-wafregional-geomatchset-geomatchconstraint-value)" : String
}
```

### YAML
<a name="aws-properties-wafregional-geomatchset-geomatchconstraint-syntax.yaml"></a>

```
  [Type](#cfn-wafregional-geomatchset-geomatchconstraint-type): String
  [Value](#cfn-wafregional-geomatchset-geomatchconstraint-value): String
```

## Properties
<a name="aws-properties-wafregional-geomatchset-geomatchconstraint-properties"></a>

`Type`  <a name="cfn-wafregional-geomatchset-geomatchconstraint-type"></a>
The type of geographical area you want AWS WAF to search for. Currently `Country` is the only valid value.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `Country`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-wafregional-geomatchset-geomatchconstraint-value"></a>
The country that you want AWS WAF to search for.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `AF | AX | AL | DZ | AS | AD | AO | AI | AQ | AG | AR | AM | AW | AU | AT | AZ | BS | BH | BD | BB | BY | BE | BZ | BJ | BM | BT | BO | BQ | BA | BW | BV | BR | IO | BN | BG | BF | BI | KH | CM | CA | CV | KY | CF | TD | CL | CN | CX | CC | CO | KM | CG | CD | CK | CR | CI | HR | CU | CW | CY | CZ | DK | DJ | DM | DO | EC | EG | SV | GQ | ER | EE | ET | FK | FO | FJ | FI | FR | GF | PF | TF | GA | GM | GE | DE | GH | GI | GR | GL | GD | GP | GU | GT | GG | GN | GW | GY | HT | HM | VA | HN | HK | HU | IS | IN | ID | IR | IQ | IE | IM | IL | IT | JM | JP | JE | JO | KZ | KE | KI | KP | KR | KW | KG | LA | LV | LB | LS | LR | LY | LI | LT | LU | MO | MK | MG | MW | MY | MV | ML | MT | MH | MQ | MR | MU | YT | MX | FM | MD | MC | MN | ME | MS | MA | MZ | MM | NA | NR | NP | NL | NC | NZ | NI | NE | NG | NU | NF | MP | NO | OM | PK | PW | PS | PA | PG | PY | PE | PH | PN | PL | PT | PR | QA | RE | RO | RU | RW | BL | SH | KN | LC | MF | PM | VC | WS | SM | ST | SA | SN | RS | SC | SL | SG | SX | SK | SI | SB | SO | ZA | GS | SS | ES | LK | SD | SR | SJ | SZ | SE | CH | SY | TW | TJ | TZ | TH | TL | TG | TK | TO | TT | TN | TR | TM | TC | TV | UG | UA | AE | GB | US | UM | UY | UZ | VU | VE | VN | VG | VI | WF | EH | YE | ZM | ZW`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::IPSet
<a name="aws-resource-wafregional-ipset"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Contains one or more IP addresses or blocks of IP addresses specified in Classless Inter-Domain Routing (CIDR) notation. AWS WAF supports IPv4 address ranges: /8 and any range between /16 through /32. AWS WAF supports IPv6 address ranges: /24, /32, /48, /56, /64, and /128.

To specify an individual IP address, you specify the four-part IP address followed by a `/32`, for example, 192.0.2.0/32. To block a range of IP addresses, you can specify /8 or any range between /16 through /32 (for IPv4) or /24, /32, /48, /56, /64, or /128 (for IPv6). For more information about CIDR notation, see the Wikipedia entry [Classless Inter-Domain Routing](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). 

## Syntax
<a name="aws-resource-wafregional-ipset-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-ipset-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::IPSet",
  "Properties" : {
      "[IPSetDescriptors](#cfn-wafregional-ipset-ipsetdescriptors)" : [ IPSetDescriptor, ... ],
      "[Name](#cfn-wafregional-ipset-name)" : String
    }
}
```

### YAML
<a name="aws-resource-wafregional-ipset-syntax.yaml"></a>

```
Type: AWS::WAFRegional::IPSet
Properties:
  [IPSetDescriptors](#cfn-wafregional-ipset-ipsetdescriptors): 
    - IPSetDescriptor
  [Name](#cfn-wafregional-ipset-name): String
```

## Properties
<a name="aws-resource-wafregional-ipset-properties"></a>

`IPSetDescriptors`  <a name="cfn-wafregional-ipset-ipsetdescriptors"></a>
The IP address type (`IPV4` or `IPV6`) and the IP address range (in CIDR notation) that web requests originate from.   
*Required*: No  
*Type*: Array of [IPSetDescriptor](aws-properties-wafregional-ipset-ipsetdescriptor.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Name`  <a name="cfn-wafregional-ipset-name"></a>
A friendly name or description of the `IPSet`. You can't change the name of an `IPSet` after you create it.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-wafregional-ipset-return-values"></a>

### Ref
<a name="aws-resource-wafregional-ipset-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-ipset-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-ipset--examples"></a>



**Topics**
+ [Define IP Addresses](#aws-resource-wafregional-ipset--examples--Define_IP_Addresses)
+ [Associate an IPSet with a Web ACL Rule](#aws-resource-wafregional-ipset--examples--Associate_an_IPSet_with_a_Web_ACL_Rule)
+ [Create a Web ACL](#aws-resource-wafregional-ipset--examples--Create_a_Web_ACL)

### Define IP Addresses
<a name="aws-resource-wafregional-ipset--examples--Define_IP_Addresses"></a>

The following example defines a set of IP addresses for a web access control list (ACL) rule.

#### JSON
<a name="aws-resource-wafregional-ipset--examples--Define_IP_Addresses--json"></a>

```
"MyIPSetBlacklist": {
  "Type": "AWS::WAFRegional::IPSet",
  "Properties": {
    "Name": "IPSet for blacklisted IP adresses",
    "IPSetDescriptors": [
      {
        "Type" : "IPV4",
        "Value" : "192.0.2.44/32"
      },
      {
        "Type" : "IPV4",
        "Value" : "192.0.7.0/24"
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-ipset--examples--Define_IP_Addresses--yaml"></a>

```
MyIPSetBlacklist: 
  Type: "AWS::WAFRegional::IPSet"
  Properties: 
    Name: "IPSet for blacklisted IP adresses"
    IPSetDescriptors: 
      - 
        Type: "IPV4"
        Value: "192.0.2.44/32"
      - 
        Type: "IPV4"
        Value: "192.0.7.0/24"
```

### Associate an IPSet with a Web ACL Rule
<a name="aws-resource-wafregional-ipset--examples--Associate_an_IPSet_with_a_Web_ACL_Rule"></a>

The following example associates the `MyIPSetBlacklist` IP Set with a web ACL rule.

#### JSON
<a name="aws-resource-wafregional-ipset--examples--Associate_an_IPSet_with_a_Web_ACL_Rule--json"></a>

```
"MyIPSetRule" : {
  "Type": "AWS::WAFRegional::Rule",
  "Properties": {
    "Name": "MyIPSetRule",
    "MetricName" : "MyIPSetRule",
    "Predicates": [
      {
        "DataId" : {  "Ref" : "MyIPSetBlacklist" },
        "Negated" : false,
        "Type" : "IPMatch"
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-ipset--examples--Associate_an_IPSet_with_a_Web_ACL_Rule--yaml"></a>

```
MyIPSetRule: 
  Type: "AWS::WAFRegional::Rule"
  Properties: 
    Name: "MyIPSetRule"
    MetricName: "MyIPSetRule"
    Predicates: 
      - 
        DataId: 
          Ref: "MyIPSetBlacklist"
        Negated: false
        Type: "IPMatch"
```

### Create a Web ACL
<a name="aws-resource-wafregional-ipset--examples--Create_a_Web_ACL"></a>

The following example associates the `MyIPSetRule` rule with a web ACL. The web ACL allows requests that originate from all IP addresses except for addresses that are defined in the `MyIPSetRule`.

#### JSON
<a name="aws-resource-wafregional-ipset--examples--Create_a_Web_ACL--json"></a>

```
"MyWebACL": {
  "Type": "AWS::WAFRegional::WebACL",
  "Properties": {
    "Name": "WebACL to block blacklisted IP addresses",
    "DefaultAction": {
      "Type": "ALLOW"
    },
    "MetricName" : "MyWebACL",
    "Rules": [
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 1,
        "RuleId" : { "Ref" : "MyIPSetRule" }
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-ipset--examples--Create_a_Web_ACL--yaml"></a>

```
MyWebACL: 
  Type: "AWS::WAFRegional::WebACL"
  Properties: 
    Name: "WebACL to block blacklisted IP addresses"
    DefaultAction: 
      Type: "ALLOW"
    MetricName: "MyWebACL"
    Rules: 
      - 
        Action: 
          Type: "BLOCK"
        Priority: 1
        RuleId: 
          Ref: "MyIPSetRule"
```

# AWS::WAFRegional::IPSet IPSetDescriptor
<a name="aws-properties-wafregional-ipset-ipsetdescriptor"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Specifies the IP address type (`IPV4` or `IPV6`) and the IP address range (in CIDR format) that web requests originate from.

## Syntax
<a name="aws-properties-wafregional-ipset-ipsetdescriptor-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-ipset-ipsetdescriptor-syntax.json"></a>

```
{
  "[Type](#cfn-wafregional-ipset-ipsetdescriptor-type)" : String,
  "[Value](#cfn-wafregional-ipset-ipsetdescriptor-value)" : String
}
```

### YAML
<a name="aws-properties-wafregional-ipset-ipsetdescriptor-syntax.yaml"></a>

```
  [Type](#cfn-wafregional-ipset-ipsetdescriptor-type): String
  [Value](#cfn-wafregional-ipset-ipsetdescriptor-value): String
```

## Properties
<a name="aws-properties-wafregional-ipset-ipsetdescriptor-properties"></a>

`Type`  <a name="cfn-wafregional-ipset-ipsetdescriptor-type"></a>
Specify `IPV4` or `IPV6`.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `IPV4 | IPV6`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-wafregional-ipset-ipsetdescriptor-value"></a>
Specify an IPv4 address by using CIDR notation. For example:  
+ To configure AWS WAF to allow, block, or count requests that originated from the IP address 192.0.2.44, specify `192.0.2.44/32`.
+ To configure AWS WAF to allow, block, or count requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, specify `192.0.2.0/24`.
For more information about CIDR notation, see the Wikipedia entry [Classless Inter-Domain Routing](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing).  
Specify an IPv6 address by using CIDR notation. For example:  
+ To configure AWS WAF to allow, block, or count requests that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify `1111:0000:0000:0000:0000:0000:0000:0111/128`.
+ To configure AWS WAF to allow, block, or count requests that originated from IP addresses 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify `1111:0000:0000:0000:0000:0000:0000:0000/64`.
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `50`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::RateBasedRule
<a name="aws-resource-wafregional-ratebasedrule"></a>

**Note**  
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

A `RateBasedRule` is identical to a regular `Rule`, with one addition: a `RateBasedRule` counts the number of requests that arrive from a specified IP address every five minutes. For example, based on recent requests that you've seen from an attacker, you might create a `RateBasedRule` that includes the following conditions: 
+ The requests come from 192.0.2.44.
+ They contain the value `BadBot` in the `User-Agent` header.

In the rule, you also define the rate limit as 15,000.

Requests that meet both of these conditions and exceed 15,000 requests every five minutes trigger the rule's action (block or count), which is defined in the web ACL.

Note you can only create rate-based rules using an CloudFormation template. To add the rate-based rules created through CloudFormation to a web ACL, use the AWS WAF console, API, or command line interface (CLI). For more information, see [UpdateWebACL](https://docs.aws.amazon.com/waf/latest/APIReference/API_regional_UpdateWebACL.html).

## Syntax
<a name="aws-resource-wafregional-ratebasedrule-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-ratebasedrule-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::RateBasedRule",
  "Properties" : {
      "[MatchPredicates](#cfn-wafregional-ratebasedrule-matchpredicates)" : [ Predicate, ... ],
      "[MetricName](#cfn-wafregional-ratebasedrule-metricname)" : String,
      "[Name](#cfn-wafregional-ratebasedrule-name)" : String,
      "[RateKey](#cfn-wafregional-ratebasedrule-ratekey)" : String,
      "[RateLimit](#cfn-wafregional-ratebasedrule-ratelimit)" : Integer
    }
}
```

### YAML
<a name="aws-resource-wafregional-ratebasedrule-syntax.yaml"></a>

```
Type: AWS::WAFRegional::RateBasedRule
Properties:
  [MatchPredicates](#cfn-wafregional-ratebasedrule-matchpredicates): 
    - Predicate
  [MetricName](#cfn-wafregional-ratebasedrule-metricname): String
  [Name](#cfn-wafregional-ratebasedrule-name): String
  [RateKey](#cfn-wafregional-ratebasedrule-ratekey): String
  [RateLimit](#cfn-wafregional-ratebasedrule-ratelimit): Integer
```

## Properties
<a name="aws-resource-wafregional-ratebasedrule-properties"></a>

`MatchPredicates`  <a name="cfn-wafregional-ratebasedrule-matchpredicates"></a>
The `Predicates` object contains one `Predicate` element for each `ByteMatchSet`, `IPSet`, or `SqlInjectionMatchSet>` object that you want to include in a `RateBasedRule`.  
*Required*: No  
*Type*: Array of [Predicate](aws-properties-wafregional-ratebasedrule-predicate.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MetricName`  <a name="cfn-wafregional-ratebasedrule-metricname"></a>
A name for the metrics for a `RateBasedRule`. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default\$1Action." You can't change the name of the metric after you create the `RateBasedRule`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Name`  <a name="cfn-wafregional-ratebasedrule-name"></a>
A friendly name or description for a `RateBasedRule`. You can't change the name of a `RateBasedRule` after you create it.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`RateKey`  <a name="cfn-wafregional-ratebasedrule-ratekey"></a>
The field that AWS WAF uses to determine if requests are likely arriving from single source and thus subject to rate monitoring. The only valid value for `RateKey` is `IP`. `IP` indicates that requests arriving from the same IP address are subject to the `RateLimit` that is specified in the `RateBasedRule`.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `IP`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`RateLimit`  <a name="cfn-wafregional-ratebasedrule-ratelimit"></a>
The maximum number of requests, which have an identical value in the field specified by the `RateKey`, allowed in a five-minute period. If the number of requests exceeds the `RateLimit` and the other predicates specified in the rule are also met, AWS WAF triggers the action that is specified for this rule.  
*Required*: Yes  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-wafregional-ratebasedrule-return-values"></a>

### Ref
<a name="aws-resource-wafregional-ratebasedrule-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-ratebasedrule-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-ratebasedrule--examples"></a>



### Associate an IPSet with a Rate-Based Rule
<a name="aws-resource-wafregional-ratebasedrule--examples--Associate_an_IPSet_with_a_Rate-Based_Rule"></a>

The following example associates the `MyIPSetBlacklist``IPSet` object with a rate-based rule.

#### JSON
<a name="aws-resource-wafregional-ratebasedrule--examples--Associate_an_IPSet_with_a_Rate-Based_Rule--json"></a>

```
"MyIPSetRateBasedRule" : {
  "Type": "AWS::WAFRegional::RateBasedRule",
  "Properties": {
    "Name": "MyIPSetRateBasedRule",
    "MetricName" : "MyIPSetRateBasedRule",
    "RateKey" : "IP",
    "RateLimit" : 8000
    "MatchPredicates": [
      {
        "DataId" : {  "Ref" : "MyIPSetBlacklist" },
        "Negated" : false,
        "Type" : "IPMatch"
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-ratebasedrule--examples--Associate_an_IPSet_with_a_Rate-Based_Rule--yaml"></a>

```
MyIPSetRateBasedRule: 
  Type: "AWS::WAFRegional::RateBasedRule"
  Properties: 
    Name: "MyIPSetRateBasedRule"
    MetricName: "MyIPSetRateBasedRule"
    RateKey : "IP"
    RateLimit : 8000
    MatchPredicates: 
      - 
        DataId: 
          Ref: "MyIPSetBlacklist"
        Negated: false
        Type: "IPMatch"
```

# AWS::WAFRegional::RateBasedRule Predicate
<a name="aws-properties-wafregional-ratebasedrule-predicate"></a>

Specifies the `ByteMatchSet`, `IPSet`, `SqlInjectionMatchSet`, `XssMatchSet`, `RegexMatchSet`, `GeoMatchSet`, and `SizeConstraintSet` objects that you want to add to a `Rule` and, for each object, indicates whether you want to negate the settings, for example, requests that do NOT originate from the IP address 192.0.2.44. 

## Syntax
<a name="aws-properties-wafregional-ratebasedrule-predicate-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-ratebasedrule-predicate-syntax.json"></a>

```
{
  "[DataId](#cfn-wafregional-ratebasedrule-predicate-dataid)" : String,
  "[Negated](#cfn-wafregional-ratebasedrule-predicate-negated)" : Boolean,
  "[Type](#cfn-wafregional-ratebasedrule-predicate-type)" : String
}
```

### YAML
<a name="aws-properties-wafregional-ratebasedrule-predicate-syntax.yaml"></a>

```
  [DataId](#cfn-wafregional-ratebasedrule-predicate-dataid): String
  [Negated](#cfn-wafregional-ratebasedrule-predicate-negated): Boolean
  [Type](#cfn-wafregional-ratebasedrule-predicate-type): String
```

## Properties
<a name="aws-properties-wafregional-ratebasedrule-predicate-properties"></a>

`DataId`  <a name="cfn-wafregional-ratebasedrule-predicate-dataid"></a>
A unique identifier for a predicate in a `Rule`, such as `ByteMatchSetId` or `IPSetId`. The ID is returned by the corresponding `Create` or `List` command.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Negated`  <a name="cfn-wafregional-ratebasedrule-predicate-negated"></a>
Set `Negated` to `False` if you want AWS WAF to allow, block, or count requests based on the settings in the specified `ByteMatchSet`, `IPSet`, `SqlInjectionMatchSet`, `XssMatchSet`, `RegexMatchSet`, `GeoMatchSet`, or `SizeConstraintSet`. For example, if an `IPSet` includes the IP address `192.0.2.44`, AWS WAF will allow or block requests based on that IP address.  
Set `Negated` to `True` if you want AWS WAF to allow or block a request based on the negation of the settings in the `ByteMatchSet`, `IPSet`, `SqlInjectionMatchSet`, `XssMatchSet`, `RegexMatchSet`, `GeoMatchSet`, or `SizeConstraintSet`>. For example, if an `IPSet` includes the IP address `192.0.2.44`, AWS WAF will allow, block, or count requests based on all IP addresses *except*`192.0.2.44`.  
*Required*: Yes  
*Type*: Boolean  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-wafregional-ratebasedrule-predicate-type"></a>
The type of predicate in a `Rule`, such as `ByteMatch` or `IPSet`.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `IPMatch | ByteMatch | SqlInjectionMatch | GeoMatch | SizeConstraint | XssMatch | RegexMatch`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::RegexPatternSet
<a name="aws-resource-wafregional-regexpatternset"></a>

The `RegexPatternSet` specifies the regular expression (regex) pattern that you want AWS WAF to search for, such as `B[a@]dB[o0]t`. You can then configure AWS WAF to reject those requests.

Note that you can only create regex pattern sets using a CloudFormation template. To add the regex pattern sets created through CloudFormation to a RegexMatchSet, use the AWS WAF console, API, or command line interface (CLI). For more information, see [UpdateRegexMatchSet](https://docs.aws.amazon.com/waf/latest/APIReference/API_regional_UpdateRegexMatchSet.html).

## Syntax
<a name="aws-resource-wafregional-regexpatternset-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-regexpatternset-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::RegexPatternSet",
  "Properties" : {
      "[Name](#cfn-wafregional-regexpatternset-name)" : String,
      "[RegexPatternStrings](#cfn-wafregional-regexpatternset-regexpatternstrings)" : [ String, ... ]
    }
}
```

### YAML
<a name="aws-resource-wafregional-regexpatternset-syntax.yaml"></a>

```
Type: AWS::WAFRegional::RegexPatternSet
Properties:
  [Name](#cfn-wafregional-regexpatternset-name): String
  [RegexPatternStrings](#cfn-wafregional-regexpatternset-regexpatternstrings): 
    - String
```

## Properties
<a name="aws-resource-wafregional-regexpatternset-properties"></a>

`Name`  <a name="cfn-wafregional-regexpatternset-name"></a>
A friendly name or description of the [AWS::WAFRegional::RegexPatternSet](#aws-resource-wafregional-regexpatternset). You can't change `Name` after you create a `RegexPatternSet`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`RegexPatternStrings`  <a name="cfn-wafregional-regexpatternset-regexpatternstrings"></a>
Specifies the regular expression (regex) patterns that you want AWS WAF to search for, such as `B[a@]dB[o0]t`.  
*Required*: Yes  
*Type*: Array of String  
*Maximum*: `10`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-wafregional-regexpatternset-return-values"></a>

### Ref
<a name="aws-resource-wafregional-regexpatternset-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-regexpatternset-return-values-fn--getatt"></a>

# AWS::WAFRegional::Rule
<a name="aws-resource-wafregional-rule"></a>

**Note**  
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

A combination of `ByteMatchSet`, `IPSet`, and/or `SqlInjectionMatchSet` objects that identify the web requests that you want to allow, block, or count. For example, you might create a `Rule` that includes the following predicates:
+ An `IPSet` that causes AWS WAF to search for web requests that originate from the IP address `192.0.2.44`
+ A `ByteMatchSet` that causes AWS WAF to search for web requests for which the value of the `User-Agent` header is `BadBot`.

To match the settings in this `Rule`, a request must originate from `192.0.2.44` AND include a `User-Agent` header for which the value is `BadBot`.

## Syntax
<a name="aws-resource-wafregional-rule-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-rule-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::Rule",
  "Properties" : {
      "[MetricName](#cfn-wafregional-rule-metricname)" : String,
      "[Name](#cfn-wafregional-rule-name)" : String,
      "[Predicates](#cfn-wafregional-rule-predicates)" : [ Predicate, ... ]
    }
}
```

### YAML
<a name="aws-resource-wafregional-rule-syntax.yaml"></a>

```
Type: AWS::WAFRegional::Rule
Properties:
  [MetricName](#cfn-wafregional-rule-metricname): String
  [Name](#cfn-wafregional-rule-name): String
  [Predicates](#cfn-wafregional-rule-predicates): 
    - Predicate
```

## Properties
<a name="aws-resource-wafregional-rule-properties"></a>

`MetricName`  <a name="cfn-wafregional-rule-metricname"></a>
A name for the metrics for this `Rule`. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default\$1Action." You can't change `MetricName` after you create the `Rule`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Name`  <a name="cfn-wafregional-rule-name"></a>
The friendly name or description for the `Rule`. You can't change the name of a `Rule` after you create it.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Predicates`  <a name="cfn-wafregional-rule-predicates"></a>
The `Predicates` object contains one `Predicate` element for each `ByteMatchSet`, `IPSet`, or `SqlInjectionMatchSet` object that you want to include in a `Rule`.  
*Required*: No  
*Type*: Array of [Predicate](aws-properties-wafregional-rule-predicate.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-wafregional-rule-return-values"></a>

### Ref
<a name="aws-resource-wafregional-rule-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-rule-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-rule--examples"></a>



### Associate an IPSet with a Web ACL Rule
<a name="aws-resource-wafregional-rule--examples--Associate_an_IPSet_with_a_Web_ACL_Rule"></a>

The following example associates the `MyIPSetBlacklist``IPSet` object with a web ACL rule.

#### JSON
<a name="aws-resource-wafregional-rule--examples--Associate_an_IPSet_with_a_Web_ACL_Rule--json"></a>

```
"MyIPSetRule" : {
  "Type": "AWS::WAFRegional::Rule",
  "Properties": {
    "Name": "MyIPSetRule",
    "MetricName" : "MyIPSetRule",
    "Predicates": [
      {
        "DataId" : {  "Ref" : "MyIPSetBlacklist" },
        "Negated" : false,
        "Type" : "IPMatch"
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-rule--examples--Associate_an_IPSet_with_a_Web_ACL_Rule--yaml"></a>

```
MyIPSetRule: 
  Type: "AWS::WAFRegional::Rule"
  Properties: 
    Name: "MyIPSetRule"
    MetricName: "MyIPSetRule"
    Predicates: 
      - 
        DataId: 
          Ref: "MyIPSetBlacklist"
        Negated: false
        Type: "IPMatch"
```

# AWS::WAFRegional::Rule Predicate
<a name="aws-properties-wafregional-rule-predicate"></a>

Specifies the `ByteMatchSet`, `IPSet`, `SqlInjectionMatchSet`, `XssMatchSet`, `RegexMatchSet`, `GeoMatchSet`, and `SizeConstraintSet` objects that you want to add to a `Rule` and, for each object, indicates whether you want to negate the settings, for example, requests that do NOT originate from the IP address 192.0.2.44. 

## Syntax
<a name="aws-properties-wafregional-rule-predicate-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-rule-predicate-syntax.json"></a>

```
{
  "[DataId](#cfn-wafregional-rule-predicate-dataid)" : String,
  "[Negated](#cfn-wafregional-rule-predicate-negated)" : Boolean,
  "[Type](#cfn-wafregional-rule-predicate-type)" : String
}
```

### YAML
<a name="aws-properties-wafregional-rule-predicate-syntax.yaml"></a>

```
  [DataId](#cfn-wafregional-rule-predicate-dataid): String
  [Negated](#cfn-wafregional-rule-predicate-negated): Boolean
  [Type](#cfn-wafregional-rule-predicate-type): String
```

## Properties
<a name="aws-properties-wafregional-rule-predicate-properties"></a>

`DataId`  <a name="cfn-wafregional-rule-predicate-dataid"></a>
A unique identifier for a predicate in a `Rule`, such as `ByteMatchSetId` or `IPSetId`. The ID is returned by the corresponding `Create` or `List` command.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Negated`  <a name="cfn-wafregional-rule-predicate-negated"></a>
Set `Negated` to `False` if you want AWS WAF to allow, block, or count requests based on the settings in the specified `ByteMatchSet`, `IPSet`, `SqlInjectionMatchSet`, `XssMatchSet`, `RegexMatchSet`, `GeoMatchSet`, or `SizeConstraintSet`. For example, if an `IPSet` includes the IP address `192.0.2.44`, AWS WAF will allow or block requests based on that IP address.  
Set `Negated` to `True` if you want AWS WAF to allow or block a request based on the negation of the settings in the `ByteMatchSet`, `IPSet`, `SqlInjectionMatchSet`, `XssMatchSet`, `RegexMatchSet`, `GeoMatchSet`, or `SizeConstraintSet`. For example, if an `IPSet` includes the IP address `192.0.2.44`, AWS WAF will allow, block, or count requests based on all IP addresses *except*`192.0.2.44`.  
*Required*: Yes  
*Type*: Boolean  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-wafregional-rule-predicate-type"></a>
The type of predicate in a `Rule`, such as `ByteMatch` or `IPSet`.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `IPMatch | ByteMatch | SqlInjectionMatch | GeoMatch | SizeConstraint | XssMatch | RegexMatch`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::SizeConstraintSet
<a name="aws-resource-wafregional-sizeconstraintset"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

A complex type that contains `SizeConstraint` objects, which specify the parts of web requests that you want AWS WAF to inspect the size of. If a `SizeConstraintSet` contains more than one `SizeConstraint` object, a request only needs to match one constraint to be considered a match.

## Syntax
<a name="aws-resource-wafregional-sizeconstraintset-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-sizeconstraintset-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::SizeConstraintSet",
  "Properties" : {
      "[Name](#cfn-wafregional-sizeconstraintset-name)" : String,
      "[SizeConstraints](#cfn-wafregional-sizeconstraintset-sizeconstraints)" : [ SizeConstraint, ... ]
    }
}
```

### YAML
<a name="aws-resource-wafregional-sizeconstraintset-syntax.yaml"></a>

```
Type: AWS::WAFRegional::SizeConstraintSet
Properties:
  [Name](#cfn-wafregional-sizeconstraintset-name): String
  [SizeConstraints](#cfn-wafregional-sizeconstraintset-sizeconstraints): 
    - SizeConstraint
```

## Properties
<a name="aws-resource-wafregional-sizeconstraintset-properties"></a>

`Name`  <a name="cfn-wafregional-sizeconstraintset-name"></a>
The name, if any, of the `SizeConstraintSet`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SizeConstraints`  <a name="cfn-wafregional-sizeconstraintset-sizeconstraints"></a>
The size constraint and the part of the web request to check.  
*Required*: No  
*Type*: Array of [SizeConstraint](aws-properties-wafregional-sizeconstraintset-sizeconstraint.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-wafregional-sizeconstraintset-return-values"></a>

### Ref
<a name="aws-resource-wafregional-sizeconstraintset-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-sizeconstraintset-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-sizeconstraintset--examples"></a>



**Topics**
+ [Define a Size Constraint](#aws-resource-wafregional-sizeconstraintset--examples--Define_a_Size_Constraint)
+ [Associate a SizeConstraintSet with a Web ACL Rule](#aws-resource-wafregional-sizeconstraintset--examples--Associate_a_SizeConstraintSet_with_a_Web_ACL_Rule)
+ [Create a Web ACL](#aws-resource-wafregional-sizeconstraintset--examples--Create_a_Web_ACL)

### Define a Size Constraint
<a name="aws-resource-wafregional-sizeconstraintset--examples--Define_a_Size_Constraint"></a>

The following example checks that the body of an HTTP request equals `4096` bytes.

#### JSON
<a name="aws-resource-wafregional-sizeconstraintset--examples--Define_a_Size_Constraint--json"></a>

```
"MySizeConstraint": {
  "Type": "AWS::WAFRegional::SizeConstraintSet",
  "Properties": {
    "Name": "SizeConstraints",
    "SizeConstraints": [
      {
        "ComparisonOperator": "EQ",
        "FieldToMatch": {
          "Type": "BODY"
        },
        "Size": "4096",
        "TextTransformation": "NONE"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-sizeconstraintset--examples--Define_a_Size_Constraint--yaml"></a>

```
  MySizeConstraint: 
    Type: "AWS::WAFRegional::SizeConstraintSet"
    Properties: 
      Name: "SizeConstraints"
      SizeConstraints: 
        - 
          ComparisonOperator: "EQ"
          FieldToMatch: 
            Type: "BODY"
          Size: "4096"
          TextTransformation: "NONE"
```

### Associate a SizeConstraintSet with a Web ACL Rule
<a name="aws-resource-wafregional-sizeconstraintset--examples--Associate_a_SizeConstraintSet_with_a_Web_ACL_Rule"></a>

The following example associates the `MySizeConstraint` object with a web ACL rule.

#### JSON
<a name="aws-resource-wafregional-sizeconstraintset--examples--Associate_a_SizeConstraintSet_with_a_Web_ACL_Rule--json"></a>

```
"SizeConstraintRule" : {
  "Type": "AWS::WAFRegional::Rule",
  "Properties": {
    "Name": "SizeConstraintRule",
    "MetricName" : "SizeConstraintRule",
    "Predicates": [
      {
        "DataId" : {  "Ref" : "MySizeConstraint" },
        "Negated" : false,
        "Type" : "SizeConstraint"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-sizeconstraintset--examples--Associate_a_SizeConstraintSet_with_a_Web_ACL_Rule--yaml"></a>

```
SizeConstraintRule: 
  Type: "AWS::WAFRegional::Rule"
  Properties: 
    Name: "SizeConstraintRule"
    MetricName: "SizeConstraintRule"
    Predicates: 
      - 
        DataId: 
          Ref: "MySizeConstraint"
        Negated: false
        Type: "SizeConstraint"
```

### Create a Web ACL
<a name="aws-resource-wafregional-sizeconstraintset--examples--Create_a_Web_ACL"></a>

The following example associates the `SizeConstraintRule` rule with a web ACL. The web ACL blocks all requests except for requests with a body size equal to `4096` bytes.

#### JSON
<a name="aws-resource-wafregional-sizeconstraintset--examples--Create_a_Web_ACL--json"></a>

```
"MyWebACL": {
  "Type": "AWS::WAFRegional::WebACL",
  "Properties": {
    "Name": "Web ACL to allow requests with a specific size",
    "DefaultAction": {
      "Type": "BLOCK"
    },
    "MetricName" : "SizeConstraintWebACL",
    "Rules": [
      {
        "Action" : {
          "Type" : "ALLOW"
        },
        "Priority" : 1,
        "RuleId" : { "Ref" : "SizeConstraintRule" }
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-sizeconstraintset--examples--Create_a_Web_ACL--yaml"></a>

```
MyWebACL: 
  Type: "AWS::WAFRegional::WebACL"
  Properties: 
    Name: "Web ACL to allow requests with a specific size"
    DefaultAction: 
      Type: "BLOCK"
    MetricName: "SizeConstraintWebACL"
    Rules: 
      - 
        Action: 
          Type: "ALLOW"
        Priority: 1
        RuleId: 
          Ref: "SizeConstraintRule"
```

# AWS::WAFRegional::SizeConstraintSet FieldToMatch
<a name="aws-properties-wafregional-sizeconstraintset-fieldtomatch"></a>

The part of a web request that you want AWS WAF to inspect, such as a specific header or a query string. 

## Syntax
<a name="aws-properties-wafregional-sizeconstraintset-fieldtomatch-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-sizeconstraintset-fieldtomatch-syntax.json"></a>

```
{
  "[Data](#cfn-wafregional-sizeconstraintset-fieldtomatch-data)" : String,
  "[Type](#cfn-wafregional-sizeconstraintset-fieldtomatch-type)" : String
}
```

### YAML
<a name="aws-properties-wafregional-sizeconstraintset-fieldtomatch-syntax.yaml"></a>

```
  [Data](#cfn-wafregional-sizeconstraintset-fieldtomatch-data): String
  [Type](#cfn-wafregional-sizeconstraintset-fieldtomatch-type): String
```

## Properties
<a name="aws-properties-wafregional-sizeconstraintset-fieldtomatch-properties"></a>

`Data`  <a name="cfn-wafregional-sizeconstraintset-fieldtomatch-data"></a>
When the value of `Type` is `HEADER`, enter the name of the header that you want AWS WAF to search, for example, `User-Agent` or `Referer`. The name of the header is not case sensitive.  
When the value of `Type` is `SINGLE_QUERY_ARG`, enter the name of the parameter that you want AWS WAF to search, for example, `UserName` or `SalesRegion`. The parameter name is not case sensitive.  
If the value of `Type` is any other value, omit `Data`.  
*Required*: Conditional  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-wafregional-sizeconstraintset-fieldtomatch-type"></a>
The part of the web request that you want AWS WAF to search for a specified string. Parts of a request that you can search include the following:  
+ `HEADER`: A specified request header, for example, the value of the `User-Agent` or `Referer` header. If you choose `HEADER` for the type, specify the name of the header in `Data`.
+ `METHOD`: The HTTP method, which indicates the type of operation that the request is asking the origin to perform. 
+ `QUERY_STRING`: A query string, which is the part of a URL that appears after a `?` character, if any.
+ `URI`: The part of a web request that identifies a resource, for example, `/images/daily-ad.jpg`.
+ `BODY`: The part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form. The request body immediately follows the request headers. Note that only the first `8192` bytes of the request body are forwarded to AWS WAF for inspection. To allow or block requests based on the length of the body, you can create a size constraint set. 
+ `SINGLE_QUERY_ARG`: The parameter in the query string that you will inspect, such as *UserName* or *SalesRegion*. The maximum length for `SINGLE_QUERY_ARG` is 30 characters.
+ `ALL_QUERY_ARGS`: Similar to `SINGLE_QUERY_ARG`, but rather than inspecting a single parameter, AWS WAF will inspect all parameters within the query for the value or regex pattern that you specify in `TargetString`.
*Required*: Yes  
*Type*: String  
*Allowed values*: `URI | QUERY_STRING | HEADER | METHOD | BODY | SINGLE_QUERY_ARG | ALL_QUERY_ARGS`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::SizeConstraintSet SizeConstraint
<a name="aws-properties-wafregional-sizeconstraintset-sizeconstraint"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Specifies a constraint on the size of a part of the web request. AWS WAF uses the `Size`, `ComparisonOperator`, and `FieldToMatch` to build an expression in the form of "`Size``ComparisonOperator` size in bytes of `FieldToMatch`". If that expression is true, the `SizeConstraint` is considered to match.

## Syntax
<a name="aws-properties-wafregional-sizeconstraintset-sizeconstraint-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-sizeconstraintset-sizeconstraint-syntax.json"></a>

```
{
  "[ComparisonOperator](#cfn-wafregional-sizeconstraintset-sizeconstraint-comparisonoperator)" : String,
  "[FieldToMatch](#cfn-wafregional-sizeconstraintset-sizeconstraint-fieldtomatch)" : FieldToMatch,
  "[Size](#cfn-wafregional-sizeconstraintset-sizeconstraint-size)" : Integer,
  "[TextTransformation](#cfn-wafregional-sizeconstraintset-sizeconstraint-texttransformation)" : String
}
```

### YAML
<a name="aws-properties-wafregional-sizeconstraintset-sizeconstraint-syntax.yaml"></a>

```
  [ComparisonOperator](#cfn-wafregional-sizeconstraintset-sizeconstraint-comparisonoperator): String
  [FieldToMatch](#cfn-wafregional-sizeconstraintset-sizeconstraint-fieldtomatch): 
    FieldToMatch
  [Size](#cfn-wafregional-sizeconstraintset-sizeconstraint-size): Integer
  [TextTransformation](#cfn-wafregional-sizeconstraintset-sizeconstraint-texttransformation): String
```

## Properties
<a name="aws-properties-wafregional-sizeconstraintset-sizeconstraint-properties"></a>

`ComparisonOperator`  <a name="cfn-wafregional-sizeconstraintset-sizeconstraint-comparisonoperator"></a>
The type of comparison you want AWS WAF to perform. AWS WAF uses this in combination with the provided `Size` and `FieldToMatch` to build an expression in the form of "`Size``ComparisonOperator` size in bytes of `FieldToMatch`". If that expression is true, the `SizeConstraint` is considered to match.  
**EQ**: Used to test if the `Size` is equal to the size of the `FieldToMatch`  
**NE**: Used to test if the `Size` is not equal to the size of the `FieldToMatch`  
**LE**: Used to test if the `Size` is less than or equal to the size of the `FieldToMatch`  
**LT**: Used to test if the `Size` is strictly less than the size of the `FieldToMatch`  
**GE**: Used to test if the `Size` is greater than or equal to the size of the `FieldToMatch`  
**GT**: Used to test if the `Size` is strictly greater than the size of the `FieldToMatch`  
*Required*: Yes  
*Type*: String  
*Allowed values*: `EQ | NE | LE | LT | GE | GT`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`FieldToMatch`  <a name="cfn-wafregional-sizeconstraintset-sizeconstraint-fieldtomatch"></a>
The part of a web request that you want AWS WAF to inspect, such as a specific header or a query string.   
*Required*: Yes  
*Type*: [FieldToMatch](aws-properties-wafregional-sizeconstraintset-fieldtomatch.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Size`  <a name="cfn-wafregional-sizeconstraintset-sizeconstraint-size"></a>
The size in bytes that you want AWS WAF to compare against the size of the specified `FieldToMatch`. AWS WAF uses this in combination with `ComparisonOperator` and `FieldToMatch` to build an expression in the form of "`Size``ComparisonOperator` size in bytes of `FieldToMatch`". If that expression is true, the `SizeConstraint` is considered to match.  
Valid values for size are 0 - 21474836480 bytes (0 - 20 GB).  
If you specify `URI` for the value of `Type`, the / in the URI path that you specify counts as one character. For example, the URI `/logo.jpg` is nine characters long.  
*Required*: Yes  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TextTransformation`  <a name="cfn-wafregional-sizeconstraintset-sizeconstraint-texttransformation"></a>
Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on `FieldToMatch` before inspecting a request for a match.  
You can only specify a single type of TextTransformation.  
Note that if you choose `BODY` for the value of `Type`, you must choose `NONE` for `TextTransformation` because the API Gateway API or Application Load Balancer forward only the first 8192 bytes for inspection.   
 **NONE**   
Specify `NONE` if you don't want to perform any text transformations.  
 **CMD\$1LINE**   
When you're concerned that attackers are injecting an operating system command line command and using unusual formatting to disguise some or all of the command, use this option to perform the following transformations:  
+ Delete the following characters: \$1 " ' ^
+ Delete spaces before the following characters: / (
+ Replace the following characters with a space: , ;
+ Replace multiple spaces with one space
+ Convert uppercase letters (A-Z) to lowercase (a-z)
 **COMPRESS\$1WHITE\$1SPACE**   
Use this option to replace the following characters with a space character (decimal 32):  
+ \$1f, formfeed, decimal 12
+ \$1t, tab, decimal 9
+ \$1n, newline, decimal 10
+ \$1r, carriage return, decimal 13
+ \$1v, vertical tab, decimal 11
+ non-breaking space, decimal 160
`COMPRESS_WHITE_SPACE` also replaces multiple spaces with one space.  
 **HTML\$1ENTITY\$1DECODE**   
Use this option to replace HTML-encoded characters with unencoded characters. `HTML_ENTITY_DECODE` performs the following operations:  
+ Replaces `(ampersand)quot;` with `"`
+ Replaces `(ampersand)nbsp;` with a non-breaking space, decimal 160
+ Replaces `(ampersand)lt;` with a "less than" symbol
+ Replaces `(ampersand)gt;` with `>`
+ Replaces characters that are represented in hexadecimal format, `(ampersand)#xhhhh;`, with the corresponding characters
+ Replaces characters that are represented in decimal format, `(ampersand)#nnnn;`, with the corresponding characters
 **LOWERCASE**   
Use this option to convert uppercase letters (A-Z) to lowercase (a-z).  
 **URL\$1DECODE**   
Use this option to decode a URL-encoded value.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `NONE | COMPRESS_WHITE_SPACE | HTML_ENTITY_DECODE | LOWERCASE | CMD_LINE | URL_DECODE`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::SqlInjectionMatchSet
<a name="aws-resource-wafregional-sqlinjectionmatchset"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

A complex type that contains `SqlInjectionMatchTuple` objects, which specify the parts of web requests that you want AWS WAF to inspect for snippets of malicious SQL code and, if you want AWS WAF to inspect a header, the name of the header. If a `SqlInjectionMatchSet` contains more than one `SqlInjectionMatchTuple` object, a request needs to include snippets of SQL code in only one of the specified parts of the request to be considered a match.

## Syntax
<a name="aws-resource-wafregional-sqlinjectionmatchset-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-sqlinjectionmatchset-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::SqlInjectionMatchSet",
  "Properties" : {
      "[Name](#cfn-wafregional-sqlinjectionmatchset-name)" : String,
      "[SqlInjectionMatchTuples](#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuples)" : [ SqlInjectionMatchTuple, ... ]
    }
}
```

### YAML
<a name="aws-resource-wafregional-sqlinjectionmatchset-syntax.yaml"></a>

```
Type: AWS::WAFRegional::SqlInjectionMatchSet
Properties:
  [Name](#cfn-wafregional-sqlinjectionmatchset-name): String
  [SqlInjectionMatchTuples](#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuples): 
    - SqlInjectionMatchTuple
```

## Properties
<a name="aws-resource-wafregional-sqlinjectionmatchset-properties"></a>

`Name`  <a name="cfn-wafregional-sqlinjectionmatchset-name"></a>
The name, if any, of the `SqlInjectionMatchSet`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SqlInjectionMatchTuples`  <a name="cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuples"></a>
Specifies the parts of web requests that you want to inspect for snippets of malicious SQL code.  
*Required*: No  
*Type*: Array of [SqlInjectionMatchTuple](aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-wafregional-sqlinjectionmatchset-return-values"></a>

### Ref
<a name="aws-resource-wafregional-sqlinjectionmatchset-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-sqlinjectionmatchset-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples"></a>



**Topics**
+ [Find SQL Injections](#aws-resource-wafregional-sqlinjectionmatchset--examples--Find_SQL_Injections)
+ [Associate a SQL Injection Match Set with a Web ACL Rule](#aws-resource-wafregional-sqlinjectionmatchset--examples--Associate_a_SQL_Injection_Match_Set_with_a_Web_ACL_Rule)
+ [Create a Web ACL](#aws-resource-wafregional-sqlinjectionmatchset--examples--Create_a_Web_ACL)

### Find SQL Injections
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Find_SQL_Injections"></a>

The following example looks for snippets of SQL code in the query string of an HTTP request.

#### JSON
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Find_SQL_Injections--json"></a>

```
"SqlInjDetection": {
  "Type": "AWS::WAFRegional::SqlInjectionMatchSet",
  "Properties": {
    "Name": "Find SQL injections in the query string",
    "SqlInjectionMatchTuples": [
      {
        "FieldToMatch" : {
          "Type": "QUERY_STRING"
        },
        "TextTransformation" : "URL_DECODE"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Find_SQL_Injections--yaml"></a>

```
SqlInjDetection: 
  Type: "AWS::WAFRegional::SqlInjectionMatchSet"
  Properties: 
    Name: "Find SQL injections in the query string"
    SqlInjectionMatchTuples: 
      - 
        FieldToMatch: 
          Type: "QUERY_STRING"
        TextTransformation: "URL_DECODE"
```

### Associate a SQL Injection Match Set with a Web ACL Rule
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Associate_a_SQL_Injection_Match_Set_with_a_Web_ACL_Rule"></a>

The following example associates the `SqlInjDetection` match set with a web access control list (ACL) rule.

#### JSON
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Associate_a_SQL_Injection_Match_Set_with_a_Web_ACL_Rule--json"></a>

```
"SqlInjRule" : {
  "Type": "AWS::WAFRegional::Rule",
  "Properties": {
    "Name": "SqlInjRule",
    "MetricName" : "SqlInjRule",
    "Predicates": [
      {
        "DataId" : {  "Ref" : "SqlInjDetection" },
        "Negated" : false,
        "Type" : "SqlInjectionMatch"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Associate_a_SQL_Injection_Match_Set_with_a_Web_ACL_Rule--yaml"></a>

```
SqlInjRule: 
  Type: "AWS::WAFRegional::Rule"
  Properties: 
    Name: "SqlInjRule"
    MetricName: "SqlInjRule"
    Predicates: 
      - 
        DataId: 
          Ref: "SqlInjDetection"
        Negated: false
        Type: "SqlInjectionMatch"
```

### Create a Web ACL
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Create_a_Web_ACL"></a>

The following example associates the `SqlInjRule` rule with a web ACL. The web ACL allows all requests except for ones with SQL code in the query string of a request.

#### JSON
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Create_a_Web_ACL--json"></a>

```
"MyWebACL": {
  "Type": "AWS::WAFRegional::WebACL",
  "Properties": {
    "Name": "Web ACL to block SQL injection in the query string",
    "DefaultAction": {
      "Type": "ALLOW"
    },
    "MetricName" : "SqlInjWebACL",
    "Rules": [
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 1,
        "RuleId" : { "Ref" : "SqlInjRule" }
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-sqlinjectionmatchset--examples--Create_a_Web_ACL--yaml"></a>

```
MyWebACL: 
  Type: "AWS::WAFRegional::WebACL"
  Properties: 
    Name: "Web ACL to block SQL injection in the query string"
    DefaultAction: 
      Type: "ALLOW"
    MetricName: "SqlInjWebACL"
    Rules: 
      - 
        Action: 
          Type: "BLOCK"
        Priority: 1
        RuleId: 
          Ref: "SqlInjRule"
```

# AWS::WAFRegional::SqlInjectionMatchSet FieldToMatch
<a name="aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch"></a>

The part of a web request that you want AWS WAF to inspect, such as a specific header or a query string. 

## Syntax
<a name="aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch-syntax.json"></a>

```
{
  "[Data](#cfn-wafregional-sqlinjectionmatchset-fieldtomatch-data)" : String,
  "[Type](#cfn-wafregional-sqlinjectionmatchset-fieldtomatch-type)" : String
}
```

### YAML
<a name="aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch-syntax.yaml"></a>

```
  [Data](#cfn-wafregional-sqlinjectionmatchset-fieldtomatch-data): String
  [Type](#cfn-wafregional-sqlinjectionmatchset-fieldtomatch-type): String
```

## Properties
<a name="aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch-properties"></a>

`Data`  <a name="cfn-wafregional-sqlinjectionmatchset-fieldtomatch-data"></a>
When the value of `Type` is `HEADER`, enter the name of the header that you want AWS WAF to search, for example, `User-Agent` or `Referer`. The name of the header is not case sensitive.  
When the value of `Type` is `SINGLE_QUERY_ARG`, enter the name of the parameter that you want AWS WAF to search, for example, `UserName` or `SalesRegion`. The parameter name is not case sensitive.  
If the value of `Type` is any other value, omit `Data`.  
*Required*: Conditional  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-wafregional-sqlinjectionmatchset-fieldtomatch-type"></a>
The part of the web request that you want AWS WAF to search for a specified string. Parts of a request that you can search include the following:  
+ `HEADER`: A specified request header, for example, the value of the `User-Agent` or `Referer` header. If you choose `HEADER` for the type, specify the name of the header in `Data`.
+ `METHOD`: The HTTP method, which indicates the type of operation that the request is asking the origin to perform. 
+ `QUERY_STRING`: A query string, which is the part of a URL that appears after a `?` character, if any.
+ `URI`: The part of a web request that identifies a resource, for example, `/images/daily-ad.jpg`.
+ `BODY`: The part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form. The request body immediately follows the request headers. Note that only the first `8192` bytes of the request body are forwarded to AWS WAF for inspection. To allow or block requests based on the length of the body, you can create a size constraint set. 
+ `SINGLE_QUERY_ARG`: The parameter in the query string that you will inspect, such as *UserName* or *SalesRegion*. The maximum length for `SINGLE_QUERY_ARG` is 30 characters.
+ `ALL_QUERY_ARGS`: Similar to `SINGLE_QUERY_ARG`, but rather than inspecting a single parameter, AWS WAF will inspect all parameters within the query for the value or regex pattern that you specify in `TargetString`.
*Required*: Yes  
*Type*: String  
*Allowed values*: `URI | QUERY_STRING | HEADER | METHOD | BODY | SINGLE_QUERY_ARG | ALL_QUERY_ARGS`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::SqlInjectionMatchSet SqlInjectionMatchTuple
<a name="aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Specifies the part of a web request that you want AWS WAF to inspect for snippets of malicious SQL code and, if you want AWS WAF to inspect a header, the name of the header.

## Syntax
<a name="aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-syntax.json"></a>

```
{
  "[FieldToMatch](#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-fieldtomatch)" : FieldToMatch,
  "[TextTransformation](#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-texttransformation)" : String
}
```

### YAML
<a name="aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-syntax.yaml"></a>

```
  [FieldToMatch](#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-fieldtomatch): 
    FieldToMatch
  [TextTransformation](#cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-texttransformation): String
```

## Properties
<a name="aws-properties-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-properties"></a>

`FieldToMatch`  <a name="cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-fieldtomatch"></a>
The part of a web request that you want AWS WAF to inspect, such as a specific header or a query string.   
*Required*: Yes  
*Type*: [FieldToMatch](aws-properties-wafregional-sqlinjectionmatchset-fieldtomatch.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TextTransformation`  <a name="cfn-wafregional-sqlinjectionmatchset-sqlinjectionmatchtuple-texttransformation"></a>
Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on `FieldToMatch` before inspecting it for a match.  
You can only specify a single type of TextTransformation.  
 **CMD\$1LINE**   
When you're concerned that attackers are injecting an operating system command line command and using unusual formatting to disguise some or all of the command, use this option to perform the following transformations:  
+ Delete the following characters: \$1 " ' ^
+ Delete spaces before the following characters: / (
+ Replace the following characters with a space: , ;
+ Replace multiple spaces with one space
+ Convert uppercase letters (A-Z) to lowercase (a-z)
 **COMPRESS\$1WHITE\$1SPACE**   
Use this option to replace the following characters with a space character (decimal 32):  
+ \$1f, formfeed, decimal 12
+ \$1t, tab, decimal 9
+ \$1n, newline, decimal 10
+ \$1r, carriage return, decimal 13
+ \$1v, vertical tab, decimal 11
+ non-breaking space, decimal 160
`COMPRESS_WHITE_SPACE` also replaces multiple spaces with one space.  
 **HTML\$1ENTITY\$1DECODE**   
Use this option to replace HTML-encoded characters with unencoded characters. `HTML_ENTITY_DECODE` performs the following operations:  
+ Replaces `(ampersand)quot;` with `"`
+ Replaces `(ampersand)nbsp;` with a non-breaking space, decimal 160
+ Replaces `(ampersand)lt;` with a "less than" symbol
+ Replaces `(ampersand)gt;` with `>`
+ Replaces characters that are represented in hexadecimal format, `(ampersand)#xhhhh;`, with the corresponding characters
+ Replaces characters that are represented in decimal format, `(ampersand)#nnnn;`, with the corresponding characters
 **LOWERCASE**   
Use this option to convert uppercase letters (A-Z) to lowercase (a-z).  
 **URL\$1DECODE**   
Use this option to decode a URL-encoded value.  
 **NONE**   
Specify `NONE` if you don't want to perform any text transformations.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `NONE | COMPRESS_WHITE_SPACE | HTML_ENTITY_DECODE | LOWERCASE | CMD_LINE | URL_DECODE`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::WebACL
<a name="aws-resource-wafregional-webacl"></a>

**Note**  
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Contains the `Rules` that identify the requests that you want to allow, block, or count. In a `WebACL`, you also specify a default action (`ALLOW` or `BLOCK`), and the action for each `Rule` that you add to a `WebACL`, for example, block requests from specified IP addresses or block requests from specified referrers. If you add more than one `Rule` to a `WebACL`, a request needs to match only one of the specifications to be allowed, blocked, or counted.

To identify the requests that you want AWS WAF to filter, you associate the `WebACL` with an API Gateway API or an Application Load Balancer. 

## Syntax
<a name="aws-resource-wafregional-webacl-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-webacl-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::WebACL",
  "Properties" : {
      "[DefaultAction](#cfn-wafregional-webacl-defaultaction)" : Action,
      "[MetricName](#cfn-wafregional-webacl-metricname)" : String,
      "[Name](#cfn-wafregional-webacl-name)" : String,
      "[Rules](#cfn-wafregional-webacl-rules)" : [ Rule, ... ]
    }
}
```

### YAML
<a name="aws-resource-wafregional-webacl-syntax.yaml"></a>

```
Type: AWS::WAFRegional::WebACL
Properties:
  [DefaultAction](#cfn-wafregional-webacl-defaultaction): 
    Action
  [MetricName](#cfn-wafregional-webacl-metricname): String
  [Name](#cfn-wafregional-webacl-name): String
  [Rules](#cfn-wafregional-webacl-rules): 
    - Rule
```

## Properties
<a name="aws-resource-wafregional-webacl-properties"></a>

`DefaultAction`  <a name="cfn-wafregional-webacl-defaultaction"></a>
The action to perform if none of the `Rules` contained in the `WebACL` match. The action is specified by the `WafAction` object.  
*Required*: Yes  
*Type*: [Action](aws-properties-wafregional-webacl-action.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MetricName`  <a name="cfn-wafregional-webacl-metricname"></a>
A name for the metrics for this `WebACL`. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default\$1Action." You can't change `MetricName` after you create the `WebACL`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Name`  <a name="cfn-wafregional-webacl-name"></a>
A friendly name or description of the `WebACL`. You can't change the name of a `WebACL` after you create it.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Rules`  <a name="cfn-wafregional-webacl-rules"></a>
An array that contains the action for each `Rule` in a `WebACL`, the priority of the `Rule`, and the ID of the `Rule`.  
*Required*: No  
*Type*: Array of [Rule](aws-properties-wafregional-webacl-rule.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-wafregional-webacl-return-values"></a>

### Ref
<a name="aws-resource-wafregional-webacl-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource name, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-webacl-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-webacl--examples"></a>



### Create a Web ACL
<a name="aws-resource-wafregional-webacl--examples--Create_a_Web_ACL"></a>

The following example defines a web ACL that allows, by default, any web request. However, if the request matches any rule, AWS WAF blocks the request. AWS WAF evaluates each rule in priority order, starting with the lowest value.

#### JSON
<a name="aws-resource-wafregional-webacl--examples--Create_a_Web_ACL--json"></a>

```
"MyWebACL": {
  "Type": "AWS::WAFRegional::WebACL",
  "Properties": {
    "Name": "WebACL to with three rules",
    "DefaultAction": {
      "Type": "ALLOW"
    },
    "MetricName" : "MyWebACL",
    "Rules": [
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 1,
        "RuleId" : { "Ref" : "MyRule" }
      },
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 2,
        "RuleId" : { "Ref" : "BadReferersRule" }
      },
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 3,
        "RuleId" : { "Ref" : "SqlInjRule" }
      }
    ]
  }      
}
```

#### YAML
<a name="aws-resource-wafregional-webacl--examples--Create_a_Web_ACL--yaml"></a>

```
MyWebACL: 
  Type: "AWS::WAFRegional::WebACL"
  Properties: 
    Name: "WebACL to with three rules"
    DefaultAction: 
      Type: "ALLOW"
    MetricName: "MyWebACL"
    Rules: 
      - 
        Action: 
          Type: "BLOCK"
        Priority: 1
        RuleId: 
          Ref: "MyRule"
      - 
        Action: 
          Type: "BLOCK"
        Priority: 2
        RuleId: 
          Ref: "BadReferersRule"
      - 
        Action: 
          Type: "BLOCK"
        Priority: 3
        RuleId: 
          Ref: "SqlInjRule"
```

# AWS::WAFRegional::WebACL Action
<a name="aws-properties-wafregional-webacl-action"></a>

Specifies the action AWS WAF takes when a web request matches or doesn't match all rule conditions. 

## Syntax
<a name="aws-properties-wafregional-webacl-action-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-webacl-action-syntax.json"></a>

```
{
  "[Type](#cfn-wafregional-webacl-action-type)" : String
}
```

### YAML
<a name="aws-properties-wafregional-webacl-action-syntax.yaml"></a>

```
  [Type](#cfn-wafregional-webacl-action-type): String
```

## Properties
<a name="aws-properties-wafregional-webacl-action-properties"></a>

`Type`  <a name="cfn-wafregional-webacl-action-type"></a>
For actions that are associated with a rule, the action that AWS WAF takes when a web request matches all conditions in a rule.  
For the default action of a web access control list (ACL), the action that AWS WAF takes when a web request doesn't match all conditions in any rule.   
Valid settings include the following:  
+ `ALLOW`: AWS WAF allows requests
+ `BLOCK`: AWS WAF blocks requests
+ `COUNT`: AWS WAF increments a counter of the requests that match all of the conditions in the rule. AWS WAF then continues to inspect the web request based on the remaining rules in the web ACL. You can't specify `COUNT` for the default action for a WebACL.
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::WebACL Rule
<a name="aws-properties-wafregional-webacl-rule"></a>

A combination of `ByteMatchSet`, `IPSet`, and/or `SqlInjectionMatchSet` objects that identify the web requests that you want to allow, block, or count. For example, you might create a `Rule` that includes the following predicates:
+ An `IPSet` that causes AWS WAF to search for web requests that originate from the IP address `192.0.2.44`
+ A `ByteMatchSet` that causes AWS WAF to search for web requests for which the value of the `User-Agent` header is `BadBot`.

To match the settings in this `Rule`, a request must originate from `192.0.2.44` AND include a `User-Agent` header for which the value is `BadBot`.

## Syntax
<a name="aws-properties-wafregional-webacl-rule-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-webacl-rule-syntax.json"></a>

```
{
  "[Action](#cfn-wafregional-webacl-rule-action)" : Action,
  "[Priority](#cfn-wafregional-webacl-rule-priority)" : Integer,
  "[RuleId](#cfn-wafregional-webacl-rule-ruleid)" : String
}
```

### YAML
<a name="aws-properties-wafregional-webacl-rule-syntax.yaml"></a>

```
  [Action](#cfn-wafregional-webacl-rule-action): 
    Action
  [Priority](#cfn-wafregional-webacl-rule-priority): Integer
  [RuleId](#cfn-wafregional-webacl-rule-ruleid): String
```

## Properties
<a name="aws-properties-wafregional-webacl-rule-properties"></a>

`Action`  <a name="cfn-wafregional-webacl-rule-action"></a>
The action that AWS WAF takes when a web request matches all conditions in the rule, such as allow, block, or count the request.  
*Required*: Yes  
*Type*: [Action](aws-properties-wafregional-webacl-action.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Priority`  <a name="cfn-wafregional-webacl-rule-priority"></a>
The order in which AWS WAF evaluates the rules in a web ACL. AWS WAF evaluates rules with a lower value before rules with a higher value. The value must be a unique integer. If you have multiple rules in a web ACL, the priority numbers do not need to be consecutive.   
*Required*: Yes  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`RuleId`  <a name="cfn-wafregional-webacl-rule-ruleid"></a>
The ID of an AWS WAF Regional rule to associate with a web ACL.   
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::WebACLAssociation
<a name="aws-resource-wafregional-webaclassociation"></a>

**Note**  
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

The AWS::WAFRegional::WebACLAssociation resource associates an AWS WAF Regional web access control group (ACL) with a resource.

## Syntax
<a name="aws-resource-wafregional-webaclassociation-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-webaclassociation-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::WebACLAssociation",
  "Properties" : {
      "[ResourceArn](#cfn-wafregional-webaclassociation-resourcearn)" : String,
      "[WebACLId](#cfn-wafregional-webaclassociation-webaclid)" : String
    }
}
```

### YAML
<a name="aws-resource-wafregional-webaclassociation-syntax.yaml"></a>

```
Type: AWS::WAFRegional::WebACLAssociation
Properties:
  [ResourceArn](#cfn-wafregional-webaclassociation-resourcearn): String
  [WebACLId](#cfn-wafregional-webaclassociation-webaclid): String
```

## Properties
<a name="aws-resource-wafregional-webaclassociation-properties"></a>

`ResourceArn`  <a name="cfn-wafregional-webaclassociation-resourcearn"></a>
The Amazon Resource Name (ARN) of the resource to protect with the web ACL.  
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`WebACLId`  <a name="cfn-wafregional-webaclassociation-webaclid"></a>
A unique identifier (ID) for the web ACL.  
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-wafregional-webaclassociation-return-values"></a>

### Fn::GetAtt
<a name="aws-resource-wafregional-webaclassociation-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-webaclassociation--examples"></a>



### Associate an Application Load Balancer resource with a web ACL
<a name="aws-resource-wafregional-webaclassociation--examples--Associate_an_Application_Load_Balancer_resource_with_a_web_ACL"></a>

The following example associates an Application Load Balancer resource with a web ACL.

#### JSON
<a name="aws-resource-wafregional-webaclassociation--examples--Associate_an_Application_Load_Balancer_resource_with_a_web_ACL--json"></a>

```
"MyWebACLAssociation": {
  "Type": "AWS::WAFRegional::WebACLAssociation",
  "Properties": {
    "ResourceArn": { "Ref": "MyLoadBalancer" },
    "WebACLId": { "Ref": "MyWebACL" }
  }
}
```

#### YAML
<a name="aws-resource-wafregional-webaclassociation--examples--Associate_an_Application_Load_Balancer_resource_with_a_web_ACL--yaml"></a>

```
MyWebACLAssociation:
  Type: "AWS::WAFRegional::WebACLAssociation"
  Properties:
    ResourceArn:
      Ref: MyLoadBalancer
    WebACLId:
      Ref: MyWebACL
```

# AWS::WAFRegional::XssMatchSet
<a name="aws-resource-wafregional-xssmatchset"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

A complex type that contains `XssMatchTuple` objects, which specify the parts of web requests that you want AWS WAF to inspect for cross-site scripting attacks and, if you want AWS WAF to inspect a header, the name of the header. If a `XssMatchSet` contains more than one `XssMatchTuple` object, a request needs to include cross-site scripting attacks in only one of the specified parts of the request to be considered a match.

## Syntax
<a name="aws-resource-wafregional-xssmatchset-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-wafregional-xssmatchset-syntax.json"></a>

```
{
  "Type" : "AWS::WAFRegional::XssMatchSet",
  "Properties" : {
      "[Name](#cfn-wafregional-xssmatchset-name)" : String,
      "[XssMatchTuples](#cfn-wafregional-xssmatchset-xssmatchtuples)" : [ XssMatchTuple, ... ]
    }
}
```

### YAML
<a name="aws-resource-wafregional-xssmatchset-syntax.yaml"></a>

```
Type: AWS::WAFRegional::XssMatchSet
Properties:
  [Name](#cfn-wafregional-xssmatchset-name): String
  [XssMatchTuples](#cfn-wafregional-xssmatchset-xssmatchtuples): 
    - XssMatchTuple
```

## Properties
<a name="aws-resource-wafregional-xssmatchset-properties"></a>

`Name`  <a name="cfn-wafregional-xssmatchset-name"></a>
The name, if any, of the `XssMatchSet`.  
*Required*: Yes  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`XssMatchTuples`  <a name="cfn-wafregional-xssmatchset-xssmatchtuples"></a>
Specifies the parts of web requests that you want to inspect for cross-site scripting attacks.  
*Required*: No  
*Type*: Array of [XssMatchTuple](aws-properties-wafregional-xssmatchset-xssmatchtuple.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-wafregional-xssmatchset-return-values"></a>

### Ref
<a name="aws-resource-wafregional-xssmatchset-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource physical ID, such as 1234a1a-a1b1-12a1-abcd-a123b123456.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-wafregional-xssmatchset-return-values-fn--getatt"></a>

## Examples
<a name="aws-resource-wafregional-xssmatchset--examples"></a>



**Topics**
+ [Define Which Part of a Request to Check for Cross-site Scripting](#aws-resource-wafregional-xssmatchset--examples--Define_Which_Part_of_a_Request_to_Check_for_Cross-site_Scripting)
+ [Associate an XssMatchSet with a Web ACL Rule](#aws-resource-wafregional-xssmatchset--examples--Associate_an_XssMatchSet_with_a_Web_ACL_Rule)
+ [Create a Web ACL](#aws-resource-wafregional-xssmatchset--examples--Create_a_Web_ACL)

### Define Which Part of a Request to Check for Cross-site Scripting
<a name="aws-resource-wafregional-xssmatchset--examples--Define_Which_Part_of_a_Request_to_Check_for_Cross-site_Scripting"></a>

The following example looks for cross-site scripting in the URI or query string of an HTTP request.

#### JSON
<a name="aws-resource-wafregional-xssmatchset--examples--Define_Which_Part_of_a_Request_to_Check_for_Cross-site_Scripting--json"></a>

```
"DetectXSS": {
  "Type": "AWS::WAFRegional::XssMatchSet",
  "Properties": {
    "Name": "XssMatchSet",
    "XssMatchTuples": [
      {
        "FieldToMatch": {
          "Type": "URI"
        },
        "TextTransformation": "NONE"
      },
      {
        "FieldToMatch": {
          "Type": "QUERY_STRING"
        },
        "TextTransformation": "NONE"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-xssmatchset--examples--Define_Which_Part_of_a_Request_to_Check_for_Cross-site_Scripting--yaml"></a>

```
DetectXSS: 
  Type: "AWS::WAFRegional::XssMatchSet"
  Properties: 
    Name: "XssMatchSet"
    XssMatchTuples: 
      - 
        FieldToMatch: 
          Type: "URI"
        TextTransformation: "NONE"
      - 
        FieldToMatch: 
          Type: "QUERY_STRING"
        TextTransformation: "NONE"
```

### Associate an XssMatchSet with a Web ACL Rule
<a name="aws-resource-wafregional-xssmatchset--examples--Associate_an_XssMatchSet_with_a_Web_ACL_Rule"></a>

The following example associates the `DetectXSS` match set with a web access control list (ACL) rule.

#### JSON
<a name="aws-resource-wafregional-xssmatchset--examples--Associate_an_XssMatchSet_with_a_Web_ACL_Rule--json"></a>

```
"XSSRule" : {
  "Type": "AWS::WAFRegional::Rule",
  "Properties": {
    "Name": "XSSRule",
    "MetricName" : "XSSRule",
    "Predicates": [
      {
        "DataId" : {  "Ref" : "DetectXSS" },
        "Negated" : false,
        "Type" : "XssMatch"
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-xssmatchset--examples--Associate_an_XssMatchSet_with_a_Web_ACL_Rule--yaml"></a>

```
XSSRule: 
  Type: "AWS::WAFRegional::Rule"
  Properties: 
    Name: "XSSRule"
    MetricName: "XSSRule"
    Predicates: 
      - 
        DataId: 
          Ref: "DetectXSS"
        Negated: false
        Type: "XssMatch"
```

### Create a Web ACL
<a name="aws-resource-wafregional-xssmatchset--examples--Create_a_Web_ACL"></a>

The following example associates the `XSSRule` rule with a web ACL. The web ACL allows all requests except for ones that contain cross-site scripting in the URI or query string of an HTTP request.

#### JSON
<a name="aws-resource-wafregional-xssmatchset--examples--Create_a_Web_ACL--json"></a>

```
"MyWebACL": {
  "Type": "AWS::WAFRegional::WebACL",
  "Properties": {
    "Name": "Web ACL to block cross-site scripting",
    "DefaultAction": {
      "Type": "ALLOW"
    },
    "MetricName" : "DetectXSSWebACL",
    "Rules": [
      {
        "Action" : {
          "Type" : "BLOCK"
        },
        "Priority" : 1,
        "RuleId" : { "Ref" : "XSSRule" }
      }
    ]
  }
}
```

#### YAML
<a name="aws-resource-wafregional-xssmatchset--examples--Create_a_Web_ACL--yaml"></a>

```
MyWebACL: 
  Type: "AWS::WAFRegional::WebACL"
  Properties: 
    Name: "Web ACL to block cross-site scripting"
    DefaultAction: 
      Type: "ALLOW"
    MetricName: "DetectXSSWebACL"
    Rules: 
      - 
        Action: 
          Type: "BLOCK"
        Priority: 1
        RuleId: 
          Ref: "XSSRule"
```

# AWS::WAFRegional::XssMatchSet FieldToMatch
<a name="aws-properties-wafregional-xssmatchset-fieldtomatch"></a>

The part of a web request that you want AWS WAF to inspect, such as a specific header or a query string. 

## Syntax
<a name="aws-properties-wafregional-xssmatchset-fieldtomatch-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-xssmatchset-fieldtomatch-syntax.json"></a>

```
{
  "[Data](#cfn-wafregional-xssmatchset-fieldtomatch-data)" : String,
  "[Type](#cfn-wafregional-xssmatchset-fieldtomatch-type)" : String
}
```

### YAML
<a name="aws-properties-wafregional-xssmatchset-fieldtomatch-syntax.yaml"></a>

```
  [Data](#cfn-wafregional-xssmatchset-fieldtomatch-data): String
  [Type](#cfn-wafregional-xssmatchset-fieldtomatch-type): String
```

## Properties
<a name="aws-properties-wafregional-xssmatchset-fieldtomatch-properties"></a>

`Data`  <a name="cfn-wafregional-xssmatchset-fieldtomatch-data"></a>
When the value of `Type` is `HEADER`, enter the name of the header that you want AWS WAF to search, for example, `User-Agent` or `Referer`. The name of the header is not case sensitive.  
When the value of `Type` is `SINGLE_QUERY_ARG`, enter the name of the parameter that you want AWS WAF to search, for example, `UserName` or `SalesRegion`. The parameter name is not case sensitive.  
If the value of `Type` is any other value, omit `Data`.  
*Required*: Conditional  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-wafregional-xssmatchset-fieldtomatch-type"></a>
The part of the web request that you want AWS WAF to search for a specified string. Parts of a request that you can search include the following:  
+ `HEADER`: A specified request header, for example, the value of the `User-Agent` or `Referer` header. If you choose `HEADER` for the type, specify the name of the header in `Data`.
+ `METHOD`: The HTTP method, which indicates the type of operation that the request is asking the origin to perform. 
+ `QUERY_STRING`: A query string, which is the part of a URL that appears after a `?` character, if any.
+ `URI`: The part of a web request that identifies a resource, for example, `/images/daily-ad.jpg`.
+ `BODY`: The part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form. The request body immediately follows the request headers. Note that only the first `8192` bytes of the request body are forwarded to AWS WAF for inspection. To allow or block requests based on the length of the body, you can create a size constraint set. 
+ `SINGLE_QUERY_ARG`: The parameter in the query string that you will inspect, such as *UserName* or *SalesRegion*. The maximum length for `SINGLE_QUERY_ARG` is 30 characters.
+ `ALL_QUERY_ARGS`: Similar to `SINGLE_QUERY_ARG`, but rather than inspecting a single parameter, AWS WAF will inspect all parameters within the query for the value or regex pattern that you specify in `TargetString`.
*Required*: Yes  
*Type*: String  
*Allowed values*: `URI | QUERY_STRING | HEADER | METHOD | BODY | SINGLE_QUERY_ARG | ALL_QUERY_ARGS`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::WAFRegional::XssMatchSet XssMatchTuple
<a name="aws-properties-wafregional-xssmatchset-xssmatchtuple"></a>

**Note**  
AWS WAF Classic support will end on September 30, 2025.   
This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.  
**For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use. 

Specifies the part of a web request that you want AWS WAF to inspect for cross-site scripting attacks and, if you want AWS WAF to inspect a header, the name of the header.

## Syntax
<a name="aws-properties-wafregional-xssmatchset-xssmatchtuple-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-wafregional-xssmatchset-xssmatchtuple-syntax.json"></a>

```
{
  "[FieldToMatch](#cfn-wafregional-xssmatchset-xssmatchtuple-fieldtomatch)" : FieldToMatch,
  "[TextTransformation](#cfn-wafregional-xssmatchset-xssmatchtuple-texttransformation)" : String
}
```

### YAML
<a name="aws-properties-wafregional-xssmatchset-xssmatchtuple-syntax.yaml"></a>

```
  [FieldToMatch](#cfn-wafregional-xssmatchset-xssmatchtuple-fieldtomatch): 
    FieldToMatch
  [TextTransformation](#cfn-wafregional-xssmatchset-xssmatchtuple-texttransformation): String
```

## Properties
<a name="aws-properties-wafregional-xssmatchset-xssmatchtuple-properties"></a>

`FieldToMatch`  <a name="cfn-wafregional-xssmatchset-xssmatchtuple-fieldtomatch"></a>
The part of a web request that you want AWS WAF to inspect, such as a specified header or a query string.  
*Required*: Yes  
*Type*: [FieldToMatch](aws-properties-wafregional-xssmatchset-fieldtomatch.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TextTransformation`  <a name="cfn-wafregional-xssmatchset-xssmatchtuple-texttransformation"></a>
Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on `FieldToMatch` before inspecting it for a match.  
You can only specify a single type of TextTransformation.  
 **CMD\$1LINE**   
When you're concerned that attackers are injecting an operating system command line command and using unusual formatting to disguise some or all of the command, use this option to perform the following transformations:  
+ Delete the following characters: \$1 " ' ^
+ Delete spaces before the following characters: / (
+ Replace the following characters with a space: , ;
+ Replace multiple spaces with one space
+ Convert uppercase letters (A-Z) to lowercase (a-z)
 **COMPRESS\$1WHITE\$1SPACE**   
Use this option to replace the following characters with a space character (decimal 32):  
+ \$1f, formfeed, decimal 12
+ \$1t, tab, decimal 9
+ \$1n, newline, decimal 10
+ \$1r, carriage return, decimal 13
+ \$1v, vertical tab, decimal 11
+ non-breaking space, decimal 160
`COMPRESS_WHITE_SPACE` also replaces multiple spaces with one space.  
 **HTML\$1ENTITY\$1DECODE**   
Use this option to replace HTML-encoded characters with unencoded characters. `HTML_ENTITY_DECODE` performs the following operations:  
+ Replaces `(ampersand)quot;` with `"`
+ Replaces `(ampersand)nbsp;` with a non-breaking space, decimal 160
+ Replaces `(ampersand)lt;` with a "less than" symbol
+ Replaces `(ampersand)gt;` with `>`
+ Replaces characters that are represented in hexadecimal format, `(ampersand)#xhhhh;`, with the corresponding characters
+ Replaces characters that are represented in decimal format, `(ampersand)#nnnn;`, with the corresponding characters
 **LOWERCASE**   
Use this option to convert uppercase letters (A-Z) to lowercase (a-z).  
 **URL\$1DECODE**   
Use this option to decode a URL-encoded value.  
 **NONE**   
Specify `NONE` if you don't want to perform any text transformations.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `NONE | COMPRESS_WHITE_SPACE | HTML_ENTITY_DECODE | LOWERCASE | CMD_LINE | URL_DECODE`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)