ladderlore
Request a guide
  • Type a service name, like S3 or IAM.

Service · Security, Identity, and Compliance

AWS WAF

A web application firewall: it filters web requests before they reach your application.

Users
Attacker or bad bot
WAF
Blocked with an error
CloudFrontLoad BalancingAPI Gateway
  1. 1Every web request, from real users or from attackers, is checked against the rules in your web ACL.
  2. 2Requests that pass go on to the protected resource, for example a CloudFront distribution, an Application Load Balancer or an API Gateway API.
  3. 3Requests that match a block rule are stopped. The sender gets an error (HTTP 403) instead of your page.
AWS WAF checks every request before it reaches the resource it protects.

Step by step

  1. 1Every web request, from real users or from attackers, is checked against the rules in your web ACL.
  2. 2Requests that pass go on to the protected resource, for example a CloudFront distribution, an Application Load Balancer or an API Gateway API.
  3. 3Requests that match a block rule are stopped. The sender gets an error (HTTP 403) instead of your page.
  • IP addresses

    Allow or block requests that come from listed IP addresses.

  • Countries

    Allow or block requests by the country they come from.

  • SQL injection

    Stop requests that hide database commands to read or change your data.

  • Cross-site scripting

    Stop requests that hide a script meant to run in other visitors’ browsers.

  • Rate limits

    Block an IP address that sends too many requests in a short time.

  • Managed rule groups

    Ready-made rules from AWS or AWS Marketplace sellers, for example against bad bots.

What WAF rules can look for.

1 / 2

  • IP addresses

    Allow or block requests that come from listed IP addresses.

  • Countries

    Allow or block requests by the country they come from.

  • SQL injection

    Stop requests that hide database commands to read or change your data.

  • Cross-site scripting

    Stop requests that hide a script meant to run in other visitors’ browsers.

2 / 2

  • Rate limits

    Block an IP address that sends too many requests in a short time.

  • Managed rule groups

    Ready-made rules from AWS or AWS Marketplace sellers, for example against bad bots.

What WAF rules can look for.

What it is

AWS WAF is a web application firewall. It looks inside each web request (HTTP or HTTPS) sent to your application. Rules you choose decide whether to allow the request, block it or only count it. This protects against common web attacks, such as SQL injection and cross-site scripting, and against unwanted bots.

What it is

You do not run WAF on a server of your own. You attach it to a resource that receives web traffic, such as an Amazon CloudFront distribution, an Application Load Balancer or an Amazon API Gateway API. The rules sit in a web access control list (web ACL), which the newer WAF console calls a protection pack. You can write your own rules or add managed rule groups from AWS or from sellers in AWS Marketplace.

What it is

WAF works at the application layer, so it can read what a request contains. A security group or a network ACL sees only IP addresses, ports and protocols. WAF rate limits help against floods of web requests, but protection from DDoS attacks as a whole is the job of AWS Shield.

Remember

  • It filters HTTP and HTTPS requests at the application layer (layer 7).
  • Attach it to CloudFront, an Application Load Balancer, API Gateway or a few other services that receive web requests.
  • A rule can allow, block or count a request, or ask the visitor to solve a CAPTCHA.
  • Count mode lets you test a new rule without blocking anyone.

Remember

  • Managed rule groups come from AWS and from AWS Marketplace sellers.
  • AWS Firewall Manager applies the same WAF rules across many accounts.

On the exam

  • “Protect a web application from SQL injection or cross-site scripting” points to AWS WAF.
  • “Block web requests from certain countries or IP addresses” points to AWS WAF. A flood of traffic meant to knock a site offline (a DDoS attack) points to AWS Shield.
  • “Block a range of IP addresses from reaching a whole subnet” points to a network ACL, not WAF. WAF filters the web requests that reach CloudFront, an Application Load Balancer or API Gateway.