SkillSprout
Chapter 10 · Lesson 1
Advanced
8 min read

Network Protection: AWS WAF, Shield, Network Firewall and DNS Firewall

Overview

Security groups and network ACLs control traffic by IP address and port. Modern threats need more: inspecting HTTP requests for SQL injection, absorbing floods, filtering outbound traffic by domain name and blocking DNS lookups of malicious sites. AWS offers specialised network protection services for each layer, and SOA-C03 asks operators to audit them in a single account and use their logs to troubleshoot.

Think of airport security. The perimeter fence and gate guards are security groups and NACLs. WAF is the baggage scanner that opens each bag (HTTP request) and checks the contents. Shield is the crowd-control team that handles a mob rushing the gates. Network Firewall is the checkpoint on the highway into the airport that inspects all vehicles. DNS Firewall is the information desk that refuses to give directions to known criminal addresses.

You will not be asked to design a full security architecture, but you must know which service addresses which threat, how they attach to resources, and how to read their logs.

Key Concepts

  • AWS WAF is a layer-7 firewall for CloudFront, ALB, API Gateway (REST), AppSync, Cognito, App Runner and Verified Access. Web ACL scope is CLOUDFRONT (created in us-east-1) or REGIONAL.
  • WAF rules: managed rule groups (AWS Core, SQLi, known bad inputs, IP reputation, bot control), rate-based rules, geo match, IP sets, regex; actions Allow, Block, Count, CAPTCHA/Challenge. Count mode tests rules before blocking.
  • WAF logging goes to CloudWatch Logs (group name must start with aws-waf-logs-), S3 or Firehose; use terminatingRuleId and sampled requests to find why a request was blocked.
  • AWS Shield Standard is automatic and free for layer 3/4 DDoS. Shield Advanced (paid, per organization) adds enhanced detection, cost protection, Shield Response Team (SRT) support, health-based detection and proactive engagement for CloudFront, Route 53, Global Accelerator, ALB, NLB/EIPs.
  • AWS Network Firewall is a managed stateful and stateless firewall inside the VPC with Suricata-compatible rules, domain lists, managed rule groups and optional TLS inspection; deployed as firewall endpoints in dedicated subnets with route tables steering traffic through them.
  • Route 53 Resolver DNS Firewall filters outbound DNS queries from VPCs using domain lists (AWS managed or custom) with actions ALLOW, ALERT, BLOCK; associate rule groups to VPCs; supports fail-open or fail-closed.
  • Egress-only internet gateway lets IPv6 instances initiate outbound connections but blocks inbound; NAT gateway does the same for IPv4. Neither is a firewall for content.
  • AWS Firewall Manager centrally deploys and audits WAF, Shield Advanced, security group, Network Firewall and DNS Firewall policies across an organization.

Detailed Notes

Which control for which threat

Threat or needServiceLayer
SQL injection, XSS, bad bots, rate limiting a login endpointAWS WAF7
Volumetric or protocol DDoSShield Standard / Advanced3, 4 (and 7 with WAF)
Block outbound traffic to non-approved domains, IDS/IPSNetwork Firewall3-7
Block DNS resolution of malware or exfiltration domainsDNS FirewallDNS
Allow/deny by port and sourceSecurity groups, NACLs3, 4
Central policy enforcement across accountsFirewall ManagerGovernance

AWS WAF essentials

bash
aws wafv2 create-web-acl --name prod-acl --scope REGIONAL --default-action Allow={} \
  --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=prodAcl \
  --rules file://rules.json --region us-east-1
aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/prod-acl/abcd \
  --resource-arn arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/web/abc
aws wafv2 put-logging-configuration --logging-configuration \
  ResourceArn=<web-acl-arn>,LogDestinationConfigs=arn:aws:logs:us-east-1:111122223333:log-group:aws-waf-logs-prod
json
{ "Name": "RateLimitLogin", "Priority": 1, "Action": { "Block": {} },
  "Statement": { "RateBasedStatement": { "Limit": 100, "AggregateKeyType": "IP",
    "ScopeDownStatement": { "ByteMatchStatement": { "SearchString": "/login", "FieldToMatch": { "UriPath": {} },
      "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ], "PositionalConstraint": "STARTS_WITH" } } } },
  "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "RateLimitLogin" } }

Rules are evaluated in priority order; the first terminating action wins. The web ACL has a capacity (WCU) limit (default 1,500). Roll out new managed rule groups in Count mode, review logs, then switch to Block.

Auditing WAF in a single account:

CheckHow
Is every internet-facing ALB/API protected?list-resources-for-web-acl; AWS Config rule wafv2-webacl-not-empty, alb-waf-enabled
Are logs enabled?get-logging-configuration; Config rule wafv2-logging-enabled
False positives blocking usersSearch WAF logs for terminatingRuleId and exclude the rule or use rule overrides
Rate rule not triggeringCheck aggregation key (IP vs forwarded IP header behind CloudFront/ALB)

Shield

FeatureStandardAdvanced
CostIncludedMonthly subscription (1-year commitment) plus data transfer fees
ProtectionCommon L3/4 attacks, automaticEnhanced, larger attacks, L7 with WAF
SupportNone specificSRT 24x7, proactive engagement
Cost protectionNoCredits for scaling charges caused by DDoS
MetricsLimitedDDoSDetected, attack diagnostics in CloudWatch

Protect resources by resource type (CloudFront, Route 53 hosted zones, Global Accelerator, ALB, EIPs). Add health-based detection with a Route 53 health check to improve detection speed.

Network Firewall deployment

Typical inspection design: traffic from the internet gateway is routed to a firewall endpoint in a dedicated firewall subnet, which forwards to the workload subnet.

bash
aws network-firewall create-rule-group --rule-group-name allow-domains --type STATEFUL --capacity 100 \
  --rule-group '{"RulesSource":{"RulesSourceList":{"Targets":[".example.com",".amazonaws.com"],"TargetTypes":["HTTP_HOST","TLS_SNI"],"GeneratedRulesType":"ALLOWLIST"}}}'
aws network-firewall create-firewall-policy --firewall-policy-name egress-policy --firewall-policy file://policy.json
aws network-firewall create-firewall --firewall-name egress-fw --firewall-policy-arn <arn> --vpc-id vpc-0abc \
  --subnet-mappings SubnetId=subnet-fw-a SubnetId=subnet-fw-b
TroubleshootingCheck
Traffic bypasses the firewallRoute tables: workload subnet default route to the firewall endpoint, IGW edge association route table for return traffic
Asymmetric routing drops flowsSame AZ endpoint used both ways
Legitimate traffic blockedAlert and flow logs (CloudWatch Logs, S3, Firehose); stateful default action and rule order (strict vs action order)
Capacity errorsRule group capacity is fixed at creation

DNS Firewall

bash
aws route53resolver create-firewall-domain-list --name bad-domains
aws route53resolver update-firewall-domains --firewall-domain-list-id rslvr-fdl-abc --operation ADD --domains malware.example.com
aws route53resolver create-firewall-rule-group --name vpc-dns-rules
aws route53resolver create-firewall-rule --firewall-rule-group-id rslvr-frg-abc --firewall-domain-list-id rslvr-fdl-abc \
  --priority 100 --action BLOCK --block-response NXDOMAIN --name block-bad
aws route53resolver associate-firewall-rule-group --firewall-rule-group-id rslvr-frg-abc --vpc-id vpc-0abc --priority 101 --name assoc

DNS Firewall only inspects queries going through the Route 53 Resolver (VPC .2 address). Instances using external DNS servers or DNS-over-HTTPS bypass it; combine with Network Firewall egress rules. Enable Resolver query logging to CloudWatch Logs, S3 or Firehose to see what was queried and blocked.

Egress options recap

ComponentIPvDirectionNotes
Internet gateway4 and 6BothNeeds route and public/Elastic IP
NAT gateway4Outbound onlyZonal, in public subnet, hourly + per-GB charge
Egress-only IGW6Outbound onlyStateful, no charge for the gateway itself

Real World Example

Scenario – credential stuffing and DNS exfiltration. A retailer sees thousands of login attempts per minute and a malware alert from GuardDuty about DNS tunneling from a private subnet.

The operator attaches a WAF web ACL to the ALB with the bot-control and IP-reputation managed rule groups in Count mode, reviews the aws-waf-logs-prod log group, then enables Block and adds a rate-based rule of 100 requests per 5 minutes for /login. For the DNS issue they associate a DNS Firewall rule group with the AWS-managed threat domain list and turn on Resolver query logging. Shield Advanced protects the CloudFront distribution and Route 53 zone with SRT engagement enabled before the holiday season.

Architecture Diagram

Layered network protection
Architecture
AWS Region
Internet
ShieldDDoS
WAFweb ACL
VPC
Network Firewallfirewall subnet
SG / NACL
Workload
DNS Firewall
  1. 1Shield absorbs volumetric and protocol attacks at the edge.
  2. 2WAF inspects HTTP requests and applies managed, rate-based and custom rules.
  3. 3Network Firewall inspects VPC traffic (ingress and egress) using stateless and stateful rules.
  4. 4Security groups and NACLs enforce basic port and IP controls on each subnet and instance.
  5. 5DNS Firewall blocks malicious domain lookups; logs from all layers go to CloudWatch, S3 or Firehose.

Best Practices

  • ✓Deploy new WAF rules in Count mode, review logs, then enforce; always enable WAF logging with aws-waf-logs- names.
  • ✓Use managed rule groups plus rate-based rules on login and API endpoints; scope down to reduce false positives.
  • ✓Place Network Firewall endpoints in dedicated subnets in each AZ and verify symmetric routing.
  • ✓Use DNS Firewall plus query logging and restrict DNS to the VPC resolver.
  • ✓Use Firewall Manager and Config rules to audit that every resource is protected.

Common Interview Questions

Exam Tips

SOA-C03 focus

  • SQL injection / bad bots / rate limit by IP at the ALB -> WAF; DDoS cost protection and SRT -> Shield Advanced.
  • WAF for CloudFront must be created in us-east-1 (scope CLOUDFRONT); log group names start with aws-waf-logs-.
  • Block outbound traffic to disallowed domains -> Network Firewall (domain lists) or DNS Firewall (DNS only).
  • IPv6 outbound-only -> egress-only internet gateway; IPv4 outbound-only -> NAT gateway.

Finished this lesson?

0 of 46 lessons done · 0% of the course