"Security groups stop web attacks." They can't see them. A security group checks ports and IP addresses. A SQL injection or a credential-stuffing run arrives on port 443, from an ordinary address, looking exactly like a normal HTTPS request. To stop it you need something that reads the request itself: AWS WAF, the web application firewall.
What WAF inspects
WAF works at layer 7. For each web request it can look at the URI path and query string, headers, cookies, body, HTTP method, source IP and country, and labels added by earlier rules. Rules combine these conditions, and each matching rule takes an action:
- Allow or Block the request.
- Count it (log only), which is how you test a rule safely before enforcing it.
- CAPTCHA or Challenge, to ask a suspicious client to prove it is a real browser or a human.
Web ACLs and where they attach
Rules live in a web ACL (the new console calls it a protection pack). You attach it to the front door of your app: Amazon CloudFront, an Application Load Balancer, an API Gateway REST API, and other resources such as AWS AppSync, Amazon Cognito user pools and AWS Amplify. Attaching at CloudFront stops bad traffic at the edge, before it reaches your Region.
Managed rules first
You don't have to write attack signatures yourself. AWS Managed Rules are rule groups maintained by AWS: the core rule set for common web exploits, SQL injection, known bad inputs, IP reputation, plus groups for specific stacks like Linux, PHP or WordPress. Marketplace sellers offer more. Start with a few, run them in Count mode, check the logs for false positives, then switch to Block.
Rate-based rules
A rate-based rule counts requests per client (by IP, or by keys such as a header) over a time window and acts on clients that exceed your limit, until their rate drops back. It is a simple, effective guard for login pages and expensive API calls. A common mistake is setting one global limit for the whole site; scope rate rules to the paths that matter, such as /login or /api/.
Bot Control
The Bot Control managed rule group (an extra charge) sorts automated traffic. The common level identifies self-identifying bots like search engines, scrapers and monitoring tools, verifies the legitimate ones and blocks unverified ones by default. The targeted level adds detection for bots that pretend to be browsers, using browser interrogation, fingerprinting, CAPTCHA and challenges, and optional machine learning for distributed, coordinated bots. Use a scope-down statement so Bot Control inspects only the pages that need it, which keeps costs down.
Where AI fits
AI crawlers and agents now hit many sites hard. Bot Control includes a CategoryAI rule that blocks AI bots by default, verified or not; bots that sign their requests with Web Bot Auth and pass verification are let through, and you can override the action or allow specific bots by their labels. Since February 2026 WAF also has an AI activity dashboard showing which AI bots and agents visit your site, the paths they request and their verification status, drawing on a catalog of more than 650 bots and agents.
Quick recap
- Security groups see ports; WAF reads requests.
- Attach a web ACL to CloudFront, an ALB or API Gateway.
- Start with AWS Managed Rules in Count mode, then block.
- Add rate-based rules and Bot Control; the AI category handles AI crawlers.