AWS WAF and Shield: Protecting Websites from Attacks, Bots and DDoS

AWS WAF and Shield: Protecting Websites from Attacks, Bots and DDoS

Written by

in

Any public website or API gets probed by bots within hours of going live: vulnerability scanners, credential-stuffing scripts, scrapers and the occasional flood of traffic. AWS offers two layers of protection at the edge. AWS Shield defends against distributed denial-of-service attacks, and AWS WAF filters individual web requests before they reach your application.

This guide explains what each one does, where they attach, a sensible starter rule set, and what the options cost.

Shield Standard and Advanced

Shield Standard is on by default for every AWS account. It protects against the most common network and transport layer DDoS attacks, such as SYN floods and UDP reflection, for resources behind CloudFront, Route 53 and Global Accelerator in particular, at no extra cost.

Shield Advanced is a paid subscription with a one-year commitment. It adds enhanced detection, access to the AWS Shield Response Team, cost protection for scaling charges caused by an attack, and AWS WAF usage for protected resources. AWS describes both in the Shield documentation.

AWS edge protection: Shield Standard absorbs common DDoS automatically, AWS WAF filters web requests with managed and rate-based rules, and Shield Advanced adds response support
Shield handles network floods; WAF decides which web requests are allowed through.

How AWS WAF works

AWS WAF inspects HTTP and HTTPS requests. You create a web ACL containing rules, evaluated in priority order. Each rule matches on request properties such as IP address, country, headers, URI, query string or body, and takes an action: allow, block, count, or a CAPTCHA or challenge. Managed rule groups from AWS and marketplace sellers cover common attacks like SQL injection and cross-site scripting without writing rules yourself. Details are in the AWS WAF developer guide.

The options side by side

OptionProtects againstCostSetup
Shield StandardCommon network and transport DDoSIncludedAutomatic
AWS WAFWeb exploits, bots, abusive IPs, floods of requestsPer web ACL, rule and requestWeb ACL and rules
Shield AdvancedLarge and sophisticated DDoS, with expert responseMonthly subscription, 1-year termSubscribe and protect resources
Security groups and NACLsUnwanted ports and IP rangesFreeVPC rules

Where protection attaches

WAF web ACLs attach to CloudFront distributions, Application Load Balancers, API Gateway, AppSync, Cognito user pools and a few other services; they do not attach directly to EC2 instances. That is another reason to put a load balancer or CloudFront in front of servers. The S3 and CloudFront guide and the Auto Scaling and load balancer guide show those setups. For port-level filtering, use security groups; the security groups vs NACLs guide explains them.

A starter rule set

  1. Core rule set (AWSManagedRulesCommonRuleSet) for common web exploits.
  2. Known bad inputs (AWSManagedRulesKnownBadInputsRuleSet) for request patterns linked to known vulnerabilities.
  3. Amazon IP reputation list to block sources associated with bots and threats.
  4. Application-specific rules such as the WordPress or PHP rule sets, or the SQL database set, if they match your stack.
  5. A rate-based rule on the whole site and a tighter one on login paths.
  6. An IP set to block known abusive addresses, and optionally to allow your office or monitoring IPs.

Rate limits and bots

A rate-based rule counts requests from each IP, or a custom key such as a header, over a rolling window and blocks or challenges anything above your threshold. Set a generous site-wide limit and a much lower one for paths like /wp-login.php or /api/login. For heavier bot problems, the Bot Control managed rule group identifies scrapers and automated clients, at an additional cost, and CAPTCHA or challenge actions let humans through while stopping simple scripts.

Rolling out without breaking things

  1. Create the web ACL with all new rules set to count.
  2. Enable WAF logging to CloudWatch Logs, S3 or Firehose, with sensitive fields redacted.
  3. Review matches for a few days and look for legitimate requests that would be blocked, such as large uploads or API payloads.
  4. Add scoped exceptions, then switch rules to block one group at a time.
  5. Keep a CloudWatch alarm on blocked request spikes so you notice attacks and false positives.

What it costs

AWS WAF bills a monthly fee per web ACL and per rule, plus a charge per million requests inspected, with extra fees for some managed rule groups and features such as Bot Control. Shield Advanced is a monthly subscription with a one-year commitment, aimed at organizations where downtime is very expensive. CloudFront’s flat-rate plans also bundle WAF and DDoS protection for a fixed monthly price. Check the AWS WAF pricing page for current figures, and watch request-based charges on high-traffic sites. The data transfer costs guide covers the CloudFront side.

Edge protection checklist

  • Public sites served through CloudFront or an ALB, not directly from instances.
  • WAF web ACL with core, known-bad-inputs and IP reputation rules.
  • Rate-based rules on the site and on login paths.
  • WAF logging on, with alarms for spikes.
  • Origin locked so only CloudFront or the ALB can reach servers.

Public-facing projects often launch quickly after an account is bought. Review the verification details listed with each AWS account, then add WAF before you point real traffic at it.

WAF and Shield questions

Is AWS Shield free?

AWS Shield Standard is included automatically for all customers at no extra charge and protects against common network and transport layer DDoS attacks. Shield Advanced is a paid subscription with a one-year commitment.

What can AWS WAF protect?

AWS WAF attaches to CloudFront distributions, Application Load Balancers, API Gateway REST APIs, AppSync, Cognito user pools and some other resources. It cannot attach directly to an EC2 instance.

How is AWS WAF priced?

WAF charges per web ACL per month, per rule per month, and per million requests inspected, with extra charges for some managed rule groups such as Bot Control. Check the AWS WAF pricing page for current rates.

What is a rate-based rule?

A rate-based rule counts requests from each IP address, or another key, over a time window and blocks or challenges sources that exceed your limit. It is a simple defense against brute-force logins and scraping.

Should I start WAF rules in block mode?

Start new rules in count mode, review the logs for a few days to spot false positives, then switch them to block. Managed rules can occasionally block legitimate requests.

Editorial guide by Mark Biden · Reviewed 24 November 2026. Official sources are linked beside the relevant sections; AWS features, quotas and prices change, so confirm details in the AWS console before relying on them.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *