Protecting Applications with AWS WAF, AWS Shield and Network Firewalls
This lesson explains how applications on AWS are protected from web exploits and distributed denial-of-service (DDoS) attacks by layers of network and application security services.
Learning outcomes
After completing this lesson, you will be able to:
- Describe what AWS WAF protects against.
- Distinguish AWS Shield Standard from AWS Shield Advanced.
- Distinguish security groups, network ACLs and AWS WAF.
- Describe how AWS Firewall Manager and AWS Marketplace tools support central management.
AWS WAF
AWS WAF, a web application firewall, protects apps served through CloudFront, Application Load Balancers, API Gateway and more. It blocks SQL injection and cross-site scripting (XSS), filters by IP address, country, headers or request rate, and offers managed rule groups.
AWS Shield
A distributed denial-of-service (DDoS) attack floods an application with traffic from many sources to make it unavailable. AWS Shield Standard protects every AWS customer automatically and at no cost against the most common DDoS attacks. AWS Shield Advanced is a paid service for applications that need more: it protects against larger and more sophisticated attacks, gives visibility of attacks as they happen, provides access to the AWS Shield Response Team at any time, and offers DDoS cost protection, which credits charges caused by scaling during an attack. The following table summarises the two tiers.
Shield Standard or Advanced?
Security groups, network ACLs and AWS WAF
AWS provides firewall controls at three levels. A security group protects individual resources, such as an EC2 instance. It contains only allow rules, and it is stateful: if a request is allowed in, the reply is allowed out automatically. A network ACL protects a whole subnet. It can allow or deny traffic, which makes it useful for blocking a specific address, and it is stateless, so replies need their own rules. At the application layer, AWS WAF inspects the content of web requests, which neither security groups nor network ACLs can do. The following table summarises the three controls.
| Control | Applies to | Behaviour |
|---|---|---|
| Security group | Instances | Stateful; allow rules only |
| Network ACL | Subnets | Stateless; allow and deny rules |
| AWS WAF | Web requests to CloudFront, load balancers and API Gateway | Inspects request content; blocks SQL injection, XSS, IPs and countries |
The following diagram places each control on the path from the internet to an instance.

Security group, network ACL or WAF?
Central management and third-party tools
Security controls can be managed centrally and supplemented with third-party tools. The following list describes the available options.
- AWS Firewall Manager centrally manages WAF rules, Shield Advanced and security groups across many accounts, applying them to new accounts automatically.
- Third-party firewalls, antivirus and monitoring tools are available in AWS Marketplace, billed through your AWS account.
Central security management
Layers of protection for a web shop
An online shop wants to protect itself from several kinds of attack. Each layer uses a different service:
| Threat | Protection |
|---|---|
| A flood of traffic trying to knock the site offline (DDoS) | AWS Shield Standard, automatically and at no cost; Shield Advanced for more protection and expert help |
| Attackers trying SQL injection in the search box | AWS WAF in front of the load balancer or CloudFront |
| Direct connections to the database from the internet | A security group on the database that allows only the web servers |
| A specific malicious IP address range | A network ACL deny rule on the subnet, or a WAF IP block rule |
| Consistent rules across the shop's ten AWS accounts | AWS Firewall Manager |
No single service stops everything; security works in layers, from the edge of the network to the database.
What does AWS WAF protect against?
Show answer
Common web attacks, such as SQL injection and cross-site scripting, by filtering HTTP requests to applications behind services such as CloudFront and Application Load Balancers.
Exam Tips
Remember for the exam
- To block SQL injection or cross-site scripting, use AWS WAF.
- DDoS protection that is free for every customer is Shield Standard.
- A DDoS response team and cost protection come with Shield Advanced.
- To manage firewall rules across many accounts, use Firewall Manager.
- An instance-level virtual firewall is a security group; a subnet-level one is a network ACL.