After analysis, your business has discovered that a partner is using a PHP crawler bot. This bot occasionally causes traffic spikes, impacting other users. While waiting for the partner to address the issue, you need to set up automatic traffic rate limits to ensure the website’s performance.
Create a rate-limiting rule allowing a maximum of 100 requests within 5 minutes. The rule matches the label awswaf:managed:aws:bot-control:bot:name:phpcrawl. When the limit is exceeded, block the requests with a custom response containing:
Verification steps for this rate-limiting differ from previous tasks. Please review the verification steps carefully.
Open the Rules tab of the Web ACL.
Click Add rules and select Add my own rules and rule groups.





On the Set rule priority page, place the phpcrawl-rate-limiter rule below the AWS WAF Bot Control managed rule.
Click Save.
Confirm the rule has been added to the list of rules on the Rules tab.
Navigate to Stack Outputs in CloudFormation and click the link Trigger Rate Limiting.
The link will simulate automated traffic by sending a large number of requests to the website.
Initially, requests receive 200 OK responses.

Once the limit is exceeded, responses switch to 429 Too Many Requests.
Confirm that the Retry-After header is included in the responses.
Congratulations! You have successfully set up a rate-limiting rule for the PHPCrawler bot, ensuring stable website performance.