Infrastructure Security · Topic 2 of 7

WAF, Shield and Firewall Manager

Protect web apps with AWS WAF web ACLs, defend against DDoS with Shield Standard and Advanced, and manage policies across accounts with Firewall Manager.

  • 5 min
In a nutshell
  • WAF works on layer 7 for CloudFront, ALB, API Gateway, AppSync and Cognito. It does not attach to a Network Load Balancer.
  • A web ACL is evaluated by rule priority, with a default action for no match. Use Count mode to test.
  • WAF for CloudFront is created in the CLOUDFRONT scope in us-east-1. Other web ACLs are Regional.

What it is

Three services protect the edge of an application. AWS WAF (Web Application Firewall) filters HTTP and HTTPS requests at layer 7, AWS Shield defends against distributed denial of service (DDoS) attacks, and AWS Firewall Manager applies these protections consistently across an organization.

Together they answer "how do we block bad web traffic and survive floods without managing every account by hand?".

InternettrafficShieldDDoS defenceWAFweb ACL rulesApplicationALB, API, CloudFront

How it works

AWS WAF

A web ACL (access control list) holds an ordered list of rules and a default action. WAF evaluates rules by priority, and the first terminating match decides the result. A web ACL can be associated with CloudFront, an Application Load Balancer, Amazon API Gateway REST APIs, AWS AppSync, Amazon Cognito user pools and some other resources.

It cannot be attached to a Network Load Balancer.

For CloudFront, create the web ACL with the global scope in us-east-1. For the other resources, the web ACL is Regional and must be in the same Region as the resource.

Rule typeWhat it does
AWS managed rule groupsReady sets, such as common attacks, known bad inputs, SQL injection and IP reputation
Rate based ruleBlocks or counts a client that exceeds a request rate over a time window
IP set matchAllow or block lists of addresses
Geo matchMatches by country of origin
Custom ruleMatch on headers, URI, body, query strings, with optional regex
Bot Control and fraud controlDetect automated clients and account takeover attempts

Rule actions are Allow, Block, Count, CAPTCHA and Challenge. Count records matches without blocking, which makes it the safe way to test a new rule before enforcing it.

{
  "Name": "RateLimitPerIP",
  "Priority": 1,
  "Statement": {
    "RateBasedStatement": { "Limit": 1000, "AggregateKeyType": "IP" }
  },
  "Action": { "Block": {} },
  "VisibilityConfig": {
    "SampledRequestsEnabled": true,
    "CloudWatchMetricsEnabled": true,
    "MetricName": "RateLimitPerIP"
  }
}

WAF logs go to CloudWatch Logs, S3 or Firehose, with a destination name that starts with aws-waf-logs-. Use logs and sampled requests to tune false positives.

AWS Shield

FeatureShield StandardShield Advanced
CostIncluded, automaticPaid subscription
LayersCommon layer 3 and 4 attacksLayer 3, 4 and, with WAF, layer 7
Protected resourcesAll AWS customers, automaticallySelected resources such as CloudFront distributions, Route 53 hosted zones, Global Accelerator accelerators, Elastic IP addresses and Application and Classic Load Balancers
ExtraNoneDDoS Response Team support, attack visibility, cost protection for scaling, health based detection, proactive engagement

For layer 7 floods, combine Shield Advanced with WAF rate based rules. Shield Advanced can also create and manage WAF rules for application layer protection on protected resources.

Designing for DDoS resilience

  • Put content behind CloudFront and Route 53, which spread load and absorb attacks at the edge.
  • Use Auto Scaling and load balancers so capacity grows with demand.
  • Hide origins. Restrict ALB security groups to CloudFront and avoid exposing instance addresses.
  • Use WAF rate based rules, and scope-down statements to avoid blocking healthy traffic.
  • Use Global Accelerator for static anycast addresses for non HTTP workloads.

AWS Firewall Manager

Firewall Manager sets up and enforces policies across accounts in an organization. It needs AWS Organizations, AWS Config, and a designated Firewall Manager administrator account.

Policy typeEnforces
AWS WAFA web ACL with rule groups on resources
Shield AdvancedProtection on chosen resources
Security groupCommon, audit or usage policies for security groups
Network FirewallFirewall endpoints and rules in VPCs
Route 53 Resolver DNS FirewallRule groups across VPCs
Network ACLNetwork ACL rules on subnets

A policy scopes to accounts, organizational units, resource types and tags. It can auto remediate: new resources that match the scope get the protection, and resources that do not comply are fixed or reported.

Admin accountFirewall Manager policyapplies toMember accountsnew and existingResourcesWAF, SG, firewall rules

Choosing

NeedChoose
Block SQL injection or cross site scriptingWAF managed rules
Limit requests per clientWAF rate based rule
Absorb a volumetric floodShield, CloudFront, Route 53
Get expert help during an attackShield Advanced
Apply the same WAF rules to every accountFirewall Manager
Allow only some countriesWAF geo match, or CloudFront geo restriction

What to remember for the exam

  • WAF works on layer 7 for CloudFront, ALB, API Gateway, AppSync and Cognito. It does not attach to a Network Load Balancer.
  • A web ACL is evaluated by rule priority, with a default action for no match. Use Count mode to test.
  • WAF for CloudFront is created in the CLOUDFRONT scope in us-east-1. Other web ACLs are Regional.
  • Shield Standard is free and automatic. Shield Advanced adds response team access, cost protection and layer 7 help with WAF.
  • Rate based rules defend against floods from single clients and aggregate by IP or other keys.
  • Firewall Manager needs Organizations and Config, and enforces WAF, Shield, security group, Network Firewall and DNS Firewall policies centrally.
  • WAF logs need a destination named with aws-waf-logs-.
  • CloudFront, Route 53 and Auto Scaling are part of DDoS resilient design.
Exam tip

If a question says "a central team must ensure every account's ALBs have the same WAF rules, including future ones", the answer is a Firewall Manager WAF policy.

Common mistakes

Blocking by default without testing. A new managed rule in Block mode can stop real users, so start in Count mode.

Attaching WAF to an NLB. WAF works on HTTP layer resources, so use security groups, Shield and Network Firewall for non HTTP traffic.

Expecting Shield Standard to stop layer 7 floods alone. It handles common network and transport attacks, and the application layer needs WAF.

Forgetting Config for Firewall Manager. Without Config enabled, policies cannot evaluate resources.

Watch out

Rate based rules count requests per source, so clients behind a shared NAT address may be blocked together, and you should use a higher limit or a more specific key.

Check yourself

  • Which resources can an AWS WAF web ACL protect?

    CloudFront, Application Load Balancers, API Gateway REST APIs, AppSync, Cognito user pools and some others, but not Network Load Balancers.

  • What extra does Shield Advanced give over Standard?

    Response team support, attack visibility, cost protection, broader resource coverage and layer 7 mitigation with WAF.

  • What prerequisites does Firewall Manager need?

    AWS Organizations, AWS Config and a designated Firewall Manager administrator account.

Topic 2 of 7 in Infrastructure Security

Test yourself on Infrastructure Security

The full AWS SCS-C03 question bank has 858 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.