CreateRuleGroupCommand

Creates a RuleGroup per the specifications provided.

A rule group defines a collection of rules to inspect and control web requests that you can use in a WebACL. When you create a rule group, you define an immutable capacity limit. If you update a rule group, you must stay within the capacity. This allows others to reuse the rule group with confidence in its capacity requirements.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { WAFV2Client, CreateRuleGroupCommand } from "@aws-sdk/client-wafv2"; // ES Modules import
// const { WAFV2Client, CreateRuleGroupCommand } = require("@aws-sdk/client-wafv2"); // CommonJS import
const client = new WAFV2Client(config);
const input = { // CreateRuleGroupRequest
  Name: "STRING_VALUE", // required
  Scope: "CLOUDFRONT" || "REGIONAL", // required
  Capacity: Number("long"), // required
  Description: "STRING_VALUE",
  Rules: [ // Rules
    { // Rule
      Name: "STRING_VALUE", // required
      Priority: Number("int"), // required
      Statement: { // Statement
        ByteMatchStatement: { // ByteMatchStatement
          SearchString: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")           // required
          FieldToMatch: { // FieldToMatch
            SingleHeader: { // SingleHeader
              Name: "STRING_VALUE", // required
            },
            SingleQueryArgument: { // SingleQueryArgument
              Name: "STRING_VALUE", // required
            },
            AllQueryArguments: {},
            UriPath: {},
            QueryString: {},
            Body: { // Body
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Method: {},
            JsonBody: { // JsonBody
              MatchPattern: { // JsonMatchPattern
                All: {},
                IncludedPaths: [ // JsonPointerPaths
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              InvalidFallbackBehavior: "MATCH" || "NO_MATCH" || "EVALUATE_AS_STRING",
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Headers: { // Headers
              MatchPattern: { // HeaderMatchPattern
                All: {},
                IncludedHeaders: [ // HeaderNames
                  "STRING_VALUE",
                ],
                ExcludedHeaders: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            Cookies: { // Cookies
              MatchPattern: { // CookieMatchPattern
                All: {},
                IncludedCookies: [ // CookieNames
                  "STRING_VALUE",
                ],
                ExcludedCookies: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            HeaderOrder: { // HeaderOrder
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            JA3Fingerprint: { // JA3Fingerprint
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            JA4Fingerprint: { // JA4Fingerprint
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            UriFragment: { // UriFragment
              FallbackBehavior: "MATCH" || "NO_MATCH",
            },
          },
          TextTransformations: [ // TextTransformations // required
            { // TextTransformation
              Priority: Number("int"), // required
              Type: "NONE" || "COMPRESS_WHITE_SPACE" || "HTML_ENTITY_DECODE" || "LOWERCASE" || "CMD_LINE" || "URL_DECODE" || "BASE64_DECODE" || "HEX_DECODE" || "MD5" || "REPLACE_COMMENTS" || "ESCAPE_SEQ_DECODE" || "SQL_HEX_DECODE" || "CSS_DECODE" || "JS_DECODE" || "NORMALIZE_PATH" || "NORMALIZE_PATH_WIN" || "REMOVE_NULLS" || "REPLACE_NULLS" || "BASE64_DECODE_EXT" || "URL_DECODE_UNI" || "UTF8_TO_UNICODE", // required
            },
          ],
          PositionalConstraint: "EXACTLY" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CONTAINS_WORD", // required
        },
        SqliMatchStatement: { // SqliMatchStatement
          FieldToMatch: {
            SingleHeader: {
              Name: "STRING_VALUE", // required
            },
            SingleQueryArgument: {
              Name: "STRING_VALUE", // required
            },
            AllQueryArguments: {},
            UriPath: {},
            QueryString: {},
            Body: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Method: {},
            JsonBody: {
              MatchPattern: {
                All: {},
                IncludedPaths: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              InvalidFallbackBehavior: "MATCH" || "NO_MATCH" || "EVALUATE_AS_STRING",
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Headers: {
              MatchPattern: {
                All: {},
                IncludedHeaders: [
                  "STRING_VALUE",
                ],
                ExcludedHeaders: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            Cookies: {
              MatchPattern: {
                All: "<All>",
                IncludedCookies: [
                  "STRING_VALUE",
                ],
                ExcludedCookies: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            HeaderOrder: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            JA3Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            JA4Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            UriFragment: {
              FallbackBehavior: "MATCH" || "NO_MATCH",
            },
          },
          TextTransformations: [ // required
            {
              Priority: Number("int"), // required
              Type: "NONE" || "COMPRESS_WHITE_SPACE" || "HTML_ENTITY_DECODE" || "LOWERCASE" || "CMD_LINE" || "URL_DECODE" || "BASE64_DECODE" || "HEX_DECODE" || "MD5" || "REPLACE_COMMENTS" || "ESCAPE_SEQ_DECODE" || "SQL_HEX_DECODE" || "CSS_DECODE" || "JS_DECODE" || "NORMALIZE_PATH" || "NORMALIZE_PATH_WIN" || "REMOVE_NULLS" || "REPLACE_NULLS" || "BASE64_DECODE_EXT" || "URL_DECODE_UNI" || "UTF8_TO_UNICODE", // required
            },
          ],
          SensitivityLevel: "LOW" || "HIGH",
        },
        XssMatchStatement: { // XssMatchStatement
          FieldToMatch: {
            SingleHeader: {
              Name: "STRING_VALUE", // required
            },
            SingleQueryArgument: {
              Name: "STRING_VALUE", // required
            },
            AllQueryArguments: {},
            UriPath: {},
            QueryString: {},
            Body: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Method: {},
            JsonBody: {
              MatchPattern: {
                All: "<All>",
                IncludedPaths: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              InvalidFallbackBehavior: "MATCH" || "NO_MATCH" || "EVALUATE_AS_STRING",
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Headers: {
              MatchPattern: {
                All: "<All>",
                IncludedHeaders: [
                  "STRING_VALUE",
                ],
                ExcludedHeaders: "<HeaderNames>",
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            Cookies: {
              MatchPattern: {
                All: "<All>",
                IncludedCookies: [
                  "STRING_VALUE",
                ],
                ExcludedCookies: "<CookieNames>",
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            HeaderOrder: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            JA3Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            JA4Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            UriFragment: {
              FallbackBehavior: "MATCH" || "NO_MATCH",
            },
          },
          TextTransformations: [ // required
            {
              Priority: Number("int"), // required
              Type: "NONE" || "COMPRESS_WHITE_SPACE" || "HTML_ENTITY_DECODE" || "LOWERCASE" || "CMD_LINE" || "URL_DECODE" || "BASE64_DECODE" || "HEX_DECODE" || "MD5" || "REPLACE_COMMENTS" || "ESCAPE_SEQ_DECODE" || "SQL_HEX_DECODE" || "CSS_DECODE" || "JS_DECODE" || "NORMALIZE_PATH" || "NORMALIZE_PATH_WIN" || "REMOVE_NULLS" || "REPLACE_NULLS" || "BASE64_DECODE_EXT" || "URL_DECODE_UNI" || "UTF8_TO_UNICODE", // required
            },
          ],
        },
        SizeConstraintStatement: { // SizeConstraintStatement
          FieldToMatch: {
            SingleHeader: {
              Name: "STRING_VALUE", // required
            },
            SingleQueryArgument: {
              Name: "STRING_VALUE", // required
            },
            AllQueryArguments: {},
            UriPath: {},
            QueryString: {},
            Body: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Method: {},
            JsonBody: {
              MatchPattern: {
                All: "<All>",
                IncludedPaths: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              InvalidFallbackBehavior: "MATCH" || "NO_MATCH" || "EVALUATE_AS_STRING",
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Headers: {
              MatchPattern: {
                All: "<All>",
                IncludedHeaders: "<HeaderNames>",
                ExcludedHeaders: "<HeaderNames>",
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            Cookies: {
              MatchPattern: {
                All: "<All>",
                IncludedCookies: "<CookieNames>",
                ExcludedCookies: "<CookieNames>",
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            HeaderOrder: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            JA3Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            JA4Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            UriFragment: {
              FallbackBehavior: "MATCH" || "NO_MATCH",
            },
          },
          ComparisonOperator: "EQ" || "NE" || "LE" || "LT" || "GE" || "GT", // required
          Size: Number("long"), // required
          TextTransformations: [ // required
            {
              Priority: Number("int"), // required
              Type: "NONE" || "COMPRESS_WHITE_SPACE" || "HTML_ENTITY_DECODE" || "LOWERCASE" || "CMD_LINE" || "URL_DECODE" || "BASE64_DECODE" || "HEX_DECODE" || "MD5" || "REPLACE_COMMENTS" || "ESCAPE_SEQ_DECODE" || "SQL_HEX_DECODE" || "CSS_DECODE" || "JS_DECODE" || "NORMALIZE_PATH" || "NORMALIZE_PATH_WIN" || "REMOVE_NULLS" || "REPLACE_NULLS" || "BASE64_DECODE_EXT" || "URL_DECODE_UNI" || "UTF8_TO_UNICODE", // required
            },
          ],
        },
        GeoMatchStatement: { // GeoMatchStatement
          CountryCodes: [ // CountryCodes
            "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" || "XK",
          ],
          ForwardedIPConfig: { // ForwardedIPConfig
            HeaderName: "STRING_VALUE", // required
            FallbackBehavior: "MATCH" || "NO_MATCH", // required
          },
        },
        RuleGroupReferenceStatement: { // RuleGroupReferenceStatement
          ARN: "STRING_VALUE", // required
          ExcludedRules: [ // ExcludedRules
            { // ExcludedRule
              Name: "STRING_VALUE", // required
            },
          ],
          RuleActionOverrides: [ // RuleActionOverrides
            { // RuleActionOverride
              Name: "STRING_VALUE", // required
              ActionToUse: { // RuleAction
                Block: { // BlockAction
                  CustomResponse: { // CustomResponse
                    ResponseCode: Number("int"), // required
                    CustomResponseBodyKey: "STRING_VALUE",
                    ResponseHeaders: [ // CustomHTTPHeaders
                      { // CustomHTTPHeader
                        Name: "STRING_VALUE", // required
                        Value: "STRING_VALUE", // required
                      },
                    ],
                  },
                },
                Allow: { // AllowAction
                  CustomRequestHandling: { // CustomRequestHandling
                    InsertHeaders: [ // required
                      {
                        Name: "STRING_VALUE", // required
                        Value: "STRING_VALUE", // required
                      },
                    ],
                  },
                },
                Count: { // CountAction
                  CustomRequestHandling: {
                    InsertHeaders: [ // required
                      {
                        Name: "STRING_VALUE", // required
                        Value: "STRING_VALUE", // required
                      },
                    ],
                  },
                },
                Captcha: { // CaptchaAction
                  CustomRequestHandling: {
                    InsertHeaders: [ // required
                      {
                        Name: "STRING_VALUE", // required
                        Value: "STRING_VALUE", // required
                      },
                    ],
                  },
                },
                Challenge: { // ChallengeAction
                  CustomRequestHandling: {
                    InsertHeaders: [ // required
                      {
                        Name: "STRING_VALUE", // required
                        Value: "STRING_VALUE", // required
                      },
                    ],
                  },
                },
              },
            },
          ],
        },
        IPSetReferenceStatement: { // IPSetReferenceStatement
          ARN: "STRING_VALUE", // required
          IPSetForwardedIPConfig: { // IPSetForwardedIPConfig
            HeaderName: "STRING_VALUE", // required
            FallbackBehavior: "MATCH" || "NO_MATCH", // required
            Position: "FIRST" || "LAST" || "ANY", // required
          },
        },
        RegexPatternSetReferenceStatement: { // RegexPatternSetReferenceStatement
          ARN: "STRING_VALUE", // required
          FieldToMatch: {
            SingleHeader: {
              Name: "STRING_VALUE", // required
            },
            SingleQueryArgument: {
              Name: "STRING_VALUE", // required
            },
            AllQueryArguments: {},
            UriPath: {},
            QueryString: {},
            Body: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Method: {},
            JsonBody: {
              MatchPattern: {
                All: "<All>",
                IncludedPaths: [
                  "STRING_VALUE",
                ],
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              InvalidFallbackBehavior: "MATCH" || "NO_MATCH" || "EVALUATE_AS_STRING",
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH",
            },
            Headers: {
              MatchPattern: {
                All: "<All>",
                IncludedHeaders: "<HeaderNames>",
                ExcludedHeaders: "<HeaderNames>",
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            Cookies: {
              MatchPattern: {
                All: "<All>",
                IncludedCookies: "<CookieNames>",
                ExcludedCookies: "<CookieNames>",
              },
              MatchScope: "ALL" || "KEY" || "VALUE", // required
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            HeaderOrder: {
              OversizeHandling: "CONTINUE" || "MATCH" || "NO_MATCH", // required
            },
            JA3Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            JA4Fingerprint: {
              FallbackBehavior: "MATCH" || "NO_MATCH", // required
            },
            UriFragment: {
              FallbackBehavior: "MATCH" || "NO_MATCH",
            },
          },
          TextTransformations: [ // required
            {
              Priority: Number("int"), // required
              Type: "NONE" || "COMPRESS_WHITE_SPACE" || "HTML_ENTITY_DECODE" || "LOWERCASE" || "CMD_LINE" || "URL_DECODE" || "BASE64_DECODE" || "HEX_DECODE" || "MD5" || "REPLACE_COMMENTS" || "ESCAPE_SEQ_DECODE" || "SQL_HEX_DECODE" || "CSS_DECODE" || "JS_DECODE" || "NORMALIZE_PATH" || "NORMALIZE_PATH_WIN" || "REMOVE_NULLS" || "REPLACE_NULLS" || "BASE64_DECODE_EXT" || "URL_DECODE_UNI" || "UTF8_TO_UNICODE", // required
            },
          ],
        },
        RateBasedStatement: { // RateBasedStatement
          Limit: Number("long"), // required
          EvaluationWindowSec: Number("long"),
          AggregateKeyType: "IP" || "FORWARDED_IP" || "CUSTOM_KEYS" || "CONSTANT", // required
          ScopeDownStatement: {
            ByteMatchStatement: {
              SearchString: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")               // required
              FieldToMatch: "<FieldToMatch>", // required
              TextTransformations: "<TextTransformations>", // required
              PositionalConstraint: "EXACTLY" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CONTAINS_WORD", // required
            },
            SqliMatchStatement: {
              FieldToMatch: "<FieldToMatch>", // required
              TextTransformations: "<TextTransformations>", // required
              SensitivityLevel: "LOW" || "HIGH",
            },
            XssMatchStatement: {
              FieldToMatch: "<FieldToMatch>", // required
              TextTransformations: "<TextTransformations>", // required
            },
            SizeConstraintStatement: {
              FieldToMatch: "<FieldToMatch>", // required
              ComparisonOperator: "EQ" || "NE" || "LE" || "LT" || "GE" || "GT", // required
              Size: Number("long"), // required
              TextTransformations: "<TextTransformations>", // required
            },
            GeoMatchStatement: {
              CountryCodes: [
                "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" || "XK",
              ],
              ForwardedIPConfig: {
                HeaderName: "STRING_VALUE", // required
                FallbackBehavior: "MATCH" || "NO_MATCH", // required
              },
            },
            RuleGroupReferenceStatement: {
              ARN: "STRING_VALUE", // required
              ExcludedRules: [
                {
                  Name: "STRING_VALUE", // required
                },
              ],
              RuleActionOverrides: [
                {
                  Name: "STRING_VALUE", // required
                  ActionToUse: {
                    Block: {
                      CustomResponse: {
                        ResponseCode: Number("int"), // required
                        CustomResponseBodyKey: "STRING_VALUE",
                        ResponseHeaders: "<CustomHTTPHeaders>",
                      },
                    },
                    Allow: {
                      CustomRequestHandling: {
                        InsertHeaders: "<CustomHTTPHeaders>", // required
                      },
                    },
                    Count: {
                      CustomRequestHandling: "<CustomRequestHandling>",
                    },
                    Captcha: {
                      CustomRequestHandling: "<CustomRequestHandling>",
                    },
                    Challenge: {
                      CustomRequestHandling: "<CustomRequestHandling>",
                    },
                  },
                },
              ],
            },
            IPSetReferenceStatement: {
              ARN: "STRING_VALUE", // required
              IPSetForwardedIPConfig: {
                HeaderName: "STRING_VALUE", // required
                FallbackBehavior: "MATCH" || "NO_MATCH", // required
                Position: "FIRST" || "LAST" || "ANY", // required
              },
            },
            RegexPatternSetReferenceStatement: {
              ARN: "STRING_VALUE", // required
              FieldToMatch: "<FieldToMatch>", // required
              TextTransformations: "<TextTransformations>", // required
            },
            RateBasedStatement: {
              Limit: Number("long"), // required
              EvaluationWindowSec: Number("long"),
              AggregateKeyType: "IP" || "FORWARDED_IP" || "CUSTOM_KEYS" || "CONSTANT", // required
              ScopeDownStatement: "<Statement>",
              ForwardedIPConfig: {
                HeaderName: "STRING_VALUE", // required
                FallbackBehavior: "MATCH" || "NO_MATCH", // required
              },
              CustomKeys: [ // RateBasedStatementCustomKeys
                { // RateBasedStatementCustomKey
                  Header: { // RateLimitHeader
                    Name: "STRING_VALUE", // required
                    TextTransformations: "<TextTransformations>", // required
                  },
                  Cookie: { // RateLimitCookie
                    Name: "STRING_VALUE", // required
                    TextTransformations: "<TextTransformations>", // required
                  },
                  QueryArgument: { // RateLimitQueryArgument
                    Name: "STRING_VALUE", // required
                    TextTransformations: "<TextTransformations>", // required
                  },
                  QueryString: { // RateLimitQueryString
                    TextTransformations: "<TextTransformations>", // required
                  },
                  HTTPMethod: {},
                  ForwardedIP: {},
                  IP: {},
                  LabelNamespace: { // RateLimitLabelNamespace
                    Namespace: "STRING_VALUE", // required
                  },
                  UriPath: { // RateLimitUriPath
                    TextTransformations: "<TextTransformations>", // required
                  },
                  JA3Fingerprint: { // RateLimitJA3Fingerprint
                    FallbackBehavior: "MATCH" || "NO_MATCH", // required
                  },
                  JA4Fingerprint: { // RateLimitJA4Fingerprint
                    FallbackBehavior: "MATCH" || "NO_MATCH", // required
                  },
                },
              ],
            },
            AndStatement: { // AndStatement
              Statements: [ // Statements // required
                "<Statement>",
              ],
            },
            OrStatement: { // OrStatement
              Statements: [ // required
                "<Statement>",
              ],
            },
            NotStatement: { // NotStatement
              Statement: "<Statement>", // required
            },
            ManagedRuleGroupStatement: { // ManagedRuleGroupStatement
              VendorName: "STRING_VALUE", // required
              Name: "STRING_VALUE", // required
              Version: "STRING_VALUE",
              ExcludedRules: [
                {
                  Name: "STRING_VALUE", // required
                },
              ],
              ScopeDownStatement: "<Statement>",
              ManagedRuleGroupConfigs: [ // ManagedRuleGroupConfigs
                { // ManagedRuleGroupConfig
                  LoginPath: "STRING_VALUE",
                  PayloadType: "JSON" || "FORM_ENCODED",
                  UsernameField: { // UsernameField
                    Identifier: "STRING_VALUE", // required
                  },
                  PasswordField: { // PasswordField
                    Identifier: "STRING_VALUE", // required
                  },
                  AWSManagedRulesBotControlRuleSet: { // AWSManagedRulesBotControlRuleSet
                    InspectionLevel: "COMMON" || "TARGETED", // required
                    EnableMachineLearning: true || false,
                  },
                  AWSManagedRulesATPRuleSet: { // AWSManagedRulesATPRuleSet
                    LoginPath: "STRING_VALUE", // required
                    RequestInspection: { // RequestInspection
                      PayloadType: "JSON" || "FORM_ENCODED", // required
                      UsernameField: {
                        Identifier: "STRING_VALUE", // required
                      },
                      PasswordField: {
                        Identifier: "STRING_VALUE", // required
                      },
                    },
                    ResponseInspection: { // ResponseInspection
                      StatusCode: { // ResponseInspectionStatusCode
                        SuccessCodes: [ // ResponseInspectionStatusCodeSuccessCodes // required
                          Number("int"),
                        ],
                        FailureCodes: [ // ResponseInspectionStatusCodeFailureCodes // required
                          Number("int"),
                        ],
                      },
                      Header: { // ResponseInspectionHeader
                        Name: "STRING_VALUE", // required
                        SuccessValues: [ // ResponseInspectionHeaderSuccessValues // required
                          "STRING_VALUE",
                        ],
                        FailureValues: [ // ResponseInspectionHeaderFailureValues // required
                          "STRING_VALUE",
                        ],
                      },
                      BodyContains: { // ResponseInspectionBodyContains
                        SuccessStrings: [ // ResponseInspectionBodyContainsSuccessStrings // required
                          "STRING_VALUE",
                        ],
                        FailureStrings: [ // ResponseInspectionBodyContainsFailureStrings // required
                          "STRING_VALUE",
                        ],
                      },
                      Json: { // ResponseInspectionJson
                        Identifier: "STRING_VALUE", // required
                        SuccessValues: [ // ResponseInspectionJsonSuccessValues // required
                          "STRING_VALUE",
                        ],
                        FailureValues: [ // ResponseInspectionJsonFailureValues // required
                          "STRING_VALUE",
                        ],
                      },
                    },
                    EnableRegexInPath: true || false,
                  },
                  AWSManagedRulesACFPRuleSet: { // AWSManagedRulesACFPRuleSet
                    CreationPath: "STRING_VALUE", // required
                    RegistrationPagePath: "STRING_VALUE", // required
                    RequestInspection: { // RequestInspectionACFP
                      PayloadType: "JSON" || "FORM_ENCODED", // required
                      UsernameField: {
                        Identifier: "STRING_VALUE", // required
                      },
                      PasswordField: {
                        Identifier: "STRING_VALUE", // required
                      },
                      EmailField: { // EmailField
                        Identifier: "STRING_VALUE", // required
                      },
                      PhoneNumberFields: [ // PhoneNumberFields
                        { // PhoneNumberField
                          Identifier: "STRING_VALUE", // required
                        },
                      ],
                      AddressFields: [ // AddressFields
                        { // AddressField
                          Identifier: "STRING_VALUE", // required
                        },
                      ],
                    },
                    ResponseInspection: {
                      StatusCode: {
                        SuccessCodes: [ // required
                          Number("int"),
                        ],
                        FailureCodes: [ // required
                          Number("int"),
                        ],
                      },
                      Header: {
                        Name: "STRING_VALUE", // required
                        SuccessValues: [ // required
                          "STRING_VALUE",
                        ],
                        FailureValues: [ // required
                          "STRING_VALUE",
                        ],
                      },
                      BodyContains: {
                        SuccessStrings: [ // required
                          "STRING_VALUE",
                        ],
                        FailureStrings: [ // required
                          "STRING_VALUE",
                        ],
                      },
                      Json: {
                        Identifier: "STRING_VALUE", // required
                        SuccessValues: [ // required
                          "STRING_VALUE",
                        ],
                        FailureValues: [ // required
                          "STRING_VALUE",
                        ],
                      },
                    },
                    EnableRegexInPath: true || false,
                  },
                },
              ],
              RuleActionOverrides: [
                {
                  Name: "STRING_VALUE", // required
                  ActionToUse: {
                    Block: {
                      CustomResponse: {
                        ResponseCode: Number("int"), // required
                        CustomResponseBodyKey: "STRING_VALUE",
                        ResponseHeaders: "<CustomHTTPHeaders>",
                      },
                    },
                    Allow: {
                      CustomRequestHandling: "<CustomRequestHandling>",
                    },
                    Count: {
                      CustomRequestHandling: "<CustomRequestHandling>",
                    },
                    Captcha: {
                      CustomRequestHandling: "<CustomRequestHandling>",
                    },
                    Challenge: {
                      CustomRequestHandling: "<CustomRequestHandling>",
                    },
                  },
                },
              ],
            },
            LabelMatchStatement: { // LabelMatchStatement
              Scope: "LABEL" || "NAMESPACE", // required
              Key: "STRING_VALUE", // required
            },
            RegexMatchStatement: { // RegexMatchStatement
              RegexString: "STRING_VALUE", // required
              FieldToMatch: "<FieldToMatch>", // required
              TextTransformations: "<TextTransformations>", // required
            },
          },
          ForwardedIPConfig: {
            HeaderName: "STRING_VALUE", // required
            FallbackBehavior: "MATCH" || "NO_MATCH", // required
          },
          CustomKeys: [
            {
              Header: {
                Name: "STRING_VALUE", // required
                TextTransformations: "<TextTransformations>", // required
              },
              Cookie: {
                Name: "STRING_VALUE", // required
                TextTransformations: "<TextTransformations>", // required
              },
              QueryArgument: {
                Name: "STRING_VALUE", // required
                TextTransformations: "<TextTransformations>", // required
              },
              QueryString: {
                TextTransformations: "<TextTransformations>", // required
              },
              HTTPMethod: {},
              ForwardedIP: {},
              IP: {},
              LabelNamespace: {
                Namespace: "STRING_VALUE", // required
              },
              UriPath: {
                TextTransformations: "<TextTransformations>", // required
              },
              JA3Fingerprint: {
                FallbackBehavior: "MATCH" || "NO_MATCH", // required
              },
              JA4Fingerprint: {
                FallbackBehavior: "MATCH" || "NO_MATCH", // required
              },
            },
          ],
        },
        AndStatement: {
          Statements: [ // required
            "<Statement>",
          ],
        },
        OrStatement: {
          Statements: [ // required
            "<Statement>",
          ],
        },
        NotStatement: {
          Statement: "<Statement>", // required
        },
        ManagedRuleGroupStatement: {
          VendorName: "STRING_VALUE", // required
          Name: "STRING_VALUE", // required
          Version: "STRING_VALUE",
          ExcludedRules: [
            {
              Name: "STRING_VALUE", // required
            },
          ],
          ScopeDownStatement: "<Statement>",
          ManagedRuleGroupConfigs: [
            {
              LoginPath: "STRING_VALUE",
              PayloadType: "JSON" || "FORM_ENCODED",
              UsernameField: "<UsernameField>",
              PasswordField: "<PasswordField>",
              AWSManagedRulesBotControlRuleSet: {
                InspectionLevel: "COMMON" || "TARGETED", // required
                EnableMachineLearning: true || false,
              },
              AWSManagedRulesATPRuleSet: {
                LoginPath: "STRING_VALUE", // required
                RequestInspection: {
                  PayloadType: "JSON" || "FORM_ENCODED", // required
                  UsernameField: "<UsernameField>", // required
                  PasswordField: "<PasswordField>", // required
                },
                ResponseInspection: {
                  StatusCode: {
                    SuccessCodes: [ // required
                      Number("int"),
                    ],
                    FailureCodes: [ // required
                      Number("int"),
                    ],
                  },
                  Header: {
                    Name: "STRING_VALUE", // required
                    SuccessValues: [ // required
                      "STRING_VALUE",
                    ],
                    FailureValues: [ // required
                      "STRING_VALUE",
                    ],
                  },
                  BodyContains: {
                    SuccessStrings: [ // required
                      "STRING_VALUE",
                    ],
                    FailureStrings: [ // required
                      "STRING_VALUE",
                    ],
                  },
                  Json: {
                    Identifier: "STRING_VALUE", // required
                    SuccessValues: [ // required
                      "STRING_VALUE",
                    ],
                    FailureValues: [ // required
                      "STRING_VALUE",
                    ],
                  },
                },
                EnableRegexInPath: true || false,
              },
              AWSManagedRulesACFPRuleSet: {
                CreationPath: "STRING_VALUE", // required
                RegistrationPagePath: "STRING_VALUE", // required
                RequestInspection: {
                  PayloadType: "JSON" || "FORM_ENCODED", // required
                  UsernameField: "<UsernameField>",
                  PasswordField: "<PasswordField>",
                  EmailField: {
                    Identifier: "STRING_VALUE", // required
                  },
                  PhoneNumberFields: [
                    {
                      Identifier: "STRING_VALUE", // required
                    },
                  ],
                  AddressFields: [
                    {
                      Identifier: "STRING_VALUE", // required
                    },
                  ],
                },
                ResponseInspection: {
                  StatusCode: {
                    SuccessCodes: [ // required
                      Number("int"),
                    ],
                    FailureCodes: [ // required
                      Number("int"),
                    ],
                  },
                  Header: {
                    Name: "STRING_VALUE", // required
                    SuccessValues: [ // required
                      "STRING_VALUE",
                    ],
                    FailureValues: [ // required
                      "STRING_VALUE",
                    ],
                  },
                  BodyContains: {
                    SuccessStrings: [ // required
                      "STRING_VALUE",
                    ],
                    FailureStrings: [ // required
                      "STRING_VALUE",
                    ],
                  },
                  Json: {
                    Identifier: "STRING_VALUE", // required
                    SuccessValues: [ // required
                      "STRING_VALUE",
                    ],
                    FailureValues: [ // required
                      "STRING_VALUE",
                    ],
                  },
                },
                EnableRegexInPath: true || false,
              },
            },
          ],
          RuleActionOverrides: [
            {
              Name: "STRING_VALUE", // required
              ActionToUse: {
                Block: {
                  CustomResponse: {
                    ResponseCode: Number("int"), // required
                    CustomResponseBodyKey: "STRING_VALUE",
                    ResponseHeaders: "<CustomHTTPHeaders>",
                  },
                },
                Allow: {
                  CustomRequestHandling: "<CustomRequestHandling>",
                },
                Count: {
                  CustomRequestHandling: "<CustomRequestHandling>",
                },
                Captcha: {
                  CustomRequestHandling: "<CustomRequestHandling>",
                },
                Challenge: {
                  CustomRequestHandling: "<CustomRequestHandling>",
                },
              },
            },
          ],
        },
        LabelMatchStatement: {
          Scope: "LABEL" || "NAMESPACE", // required
          Key: "STRING_VALUE", // required
        },
        RegexMatchStatement: {
          RegexString: "STRING_VALUE", // required
          FieldToMatch: "<FieldToMatch>", // required
          TextTransformations: "<TextTransformations>", // required
        },
      },
      Action: "<RuleAction>",
      OverrideAction: { // OverrideAction
        Count: "<CountAction>",
        None: {},
      },
      RuleLabels: [ // Labels
        { // Label
          Name: "STRING_VALUE", // required
        },
      ],
      VisibilityConfig: { // VisibilityConfig
        SampledRequestsEnabled: true || false, // required
        CloudWatchMetricsEnabled: true || false, // required
        MetricName: "STRING_VALUE", // required
      },
      CaptchaConfig: { // CaptchaConfig
        ImmunityTimeProperty: { // ImmunityTimeProperty
          ImmunityTime: Number("long"), // required
        },
      },
      ChallengeConfig: { // ChallengeConfig
        ImmunityTimeProperty: {
          ImmunityTime: Number("long"), // required
        },
      },
    },
  ],
  VisibilityConfig: {
    SampledRequestsEnabled: true || false, // required
    CloudWatchMetricsEnabled: true || false, // required
    MetricName: "STRING_VALUE", // required
  },
  Tags: [ // TagList
    { // Tag
      Key: "STRING_VALUE", // required
      Value: "STRING_VALUE", // required
    },
  ],
  CustomResponseBodies: { // CustomResponseBodies
    "<keys>": { // CustomResponseBody
      ContentType: "TEXT_PLAIN" || "TEXT_HTML" || "APPLICATION_JSON", // required
      Content: "STRING_VALUE", // required
    },
  },
};
const command = new CreateRuleGroupCommand(input);
const response = await client.send(command);
// { // CreateRuleGroupResponse
//   Summary: { // RuleGroupSummary
//     Name: "STRING_VALUE",
//     Id: "STRING_VALUE",
//     Description: "STRING_VALUE",
//     LockToken: "STRING_VALUE",
//     ARN: "STRING_VALUE",
//   },
// };

CreateRuleGroupCommand Input

See CreateRuleGroupCommandInput for more details

Parameter
Type
Description
Capacity
Required
number | undefined

The web ACL capacity units (WCUs) required for this rule group.

When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity for a set of rules using CheckCapacity.

WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. For more information, see WAF web ACL capacity units (WCU)  in the WAF Developer Guide.

Name
Required
string | undefined

The name of the rule group. You cannot change the name of a rule group after you create it.

Scope
Required
Scope | undefined

Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use CLOUDFRONT.

To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:

  • CLI - Specify the Region when you use the CloudFront scope: --scope=CLOUDFRONT --region=us-east-1.

  • API and SDKs - For all calls, use the Region endpoint us-east-1.

VisibilityConfig
Required
VisibilityConfig | undefined

Defines and enables Amazon CloudWatch metrics and web request sample collection.

CustomResponseBodies
Record<string, CustomResponseBody> | undefined

A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.

For information about customizing web requests and responses, see Customizing web requests and responses in WAF  in the WAF Developer Guide.

For information about the limits on count and size for custom request and response settings, see WAF quotas  in the WAF Developer Guide.

Description
string | undefined

A description of the rule group that helps with identification.

Rules
Rule[] | undefined

The Rule statements used to identify the web requests that you want to manage. Each rule includes one top-level statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.

Tags
Tag[] | undefined

An array of key:value pairs to associate with the resource.

CreateRuleGroupCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Summary
RuleGroupSummary | undefined

High-level information about a RuleGroup, returned by operations like create and list. This provides information like the ID, that you can use to retrieve and manage a RuleGroup, and the ARN, that you provide to the RuleGroupReferenceStatement to use the rule group in a Rule.

Throws

Name
Fault
Details
WAFDuplicateItemException
client

WAF couldn’t perform the operation because the resource that you tried to save is a duplicate of an existing one.

WAFInternalErrorException
server

Your request is valid, but WAF couldn’t perform the operation because of a system problem. Retry your request.

WAFInvalidOperationException
client

The operation isn't valid.

WAFInvalidParameterException
client

The operation failed because WAF didn't recognize a parameter in the request. For example:

  • You specified a parameter name or value that isn't valid.

  • Your nested statement isn't valid. You might have tried to nest a statement that can’t be nested.

  • You tried to update a WebACL with a DefaultAction that isn't among the types available at DefaultAction.

  • Your request references an ARN that is malformed, or corresponds to a resource with which a web ACL can't be associated.

WAFLimitsExceededException
client

WAF couldn’t perform the operation because you exceeded your resource limit. For example, the maximum number of WebACL objects that you can create for an Amazon Web Services account. For more information, see WAF quotas  in the WAF Developer Guide.

WAFNonexistentItemException
client

WAF couldn’t perform the operation because your resource doesn't exist. If you've just created a resource that you're using in this operation, you might just need to wait a few minutes. It can take from a few seconds to a number of minutes for changes to propagate.

WAFOptimisticLockException
client

WAF couldn’t save your changes because you tried to update or delete a resource that has changed since you last retrieved it. Get the resource again, make any changes you need to make to the new copy, and retry your operation.

WAFSubscriptionNotFoundException
client

You tried to use a managed rule group that's available by subscription, but you aren't subscribed to it yet.

WAFTagOperationException
client

An error occurred during the tagging operation. Retry your request.

WAFTagOperationInternalErrorException
server

WAF couldn’t perform your tagging operation because of an internal error. Retry your request.

WAFUnavailableEntityException
client

WAF couldn’t retrieve a resource that you specified for this operation. If you've just created a resource that you're using in this operation, you might just need to wait a few minutes. It can take from a few seconds to a number of minutes for changes to propagate. Verify the resource specifications in your request parameters and then retry the operation.

WAFV2ServiceException
Base exception class for all service exceptions from WAFV2 service.