在 Rules (規則) 下,選擇 Add rules (新增規則),然後選取 Add my own rules and rule groups (新增我自己的規則和規則群組)。
在 Rule type (規則類型) 頁面上,輸入下列資訊:
在 Rule type (規則類型) 中,選擇 Rule Builder (規則建置器)。
在 Name (名稱) 中,輸入規則名稱。
在 Type (類型) 中,選擇 Rate-based rule (速率型規則)。
在 Rate limit (速率限制) 中,輸入限制。
在 Evaluation window (評估視窗) 中,選取一個值。
在 Request aggregation (請求彙總) 中,選擇您想要的速率限制方式。如需詳細資訊,請參閱在 AWS WAF 中彙總速率型規則。 注意:如果您的流量來自 Proxy 或 CDN,請在標頭中使用 IP 位址。如需詳細資訊,請參閱在 AWS WAF 中使用轉送 IP 位址。
在 Scope of inspection and rate limiting (檢查範圍和速率限制) 中,選取 Only consider requests that match the criteria in a rule statement (僅考慮符合規則陳述式條件的請求)。
在 If a request (如果請求) 中,選取 matches the statement (符合陳述式)。如果要新增多個 URI 路徑條件,請選取 matches at least one of the statements (OR) (至少符合其中一個陳述式 (OR))。
在 Statement (陳述式) 中,輸入下列資訊:
在 Inspect (檢查) 中,選擇 Originates from an IP address in (源自以下位置中的 IP 位址)。
在 IP set (IP 集) 中,選取您的 IP 集。
在 IP address to use for rate limiting (用於速率限制的 IP 位址) 中,選擇下列項目:
如果您要根據用戶端 IP 欄位位進行速率限制,請選取 Source IP address (來源 IP 位址)。
如果您要根據標頭中的 IP 位址進行速率限制,請選取 IP address in header (標頭中的 IP 位址)。
在 Action (動作) 中,選擇 Block (封鎖)。
選擇 Add rule (新增規則)。
在 Set Rule Priority (設定規則優先順序) 中選取您的規則,然後更新其優先順序。如需詳細資訊,請參閱在 Web ACL 中設定規則優先順序。