Courseiva
Security and CompliancemediumMultiple ChoiceObjective-mapped

AWS WAF vs Shield Advanced: Which Service Blocks SQL Injection and XSS?

A company hosts a web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The security team wants to protect the application from common web exploits, including SQL injection and cross-site scripting (XSS). The solution must integrate directly with the ALB and allow custom rules to be defined. Which AWS service should the company use?

Quick Answer

The answer is AWS WAF. This service is the correct choice because it functions as a web application firewall that integrates directly with an Application Load Balancer to inspect incoming HTTP(S) requests, using both managed rule sets and custom rules to block SQL injection and cross-site scripting (XSS) at the application layer. On the AWS Certified Cloud Practitioner CLF-C02 exam, this question tests your understanding of which security service operates at Layer 7 versus network-layer protections like security groups or AWS Shield Advanced, which only defends against DDoS attacks and lacks the ability to filter specific web exploits. A common trap is confusing Shield Advanced with WAF, but remember: Shield stops floods, WAF filters the bad code. For your exam, keep this memory tip handy: WAF watches the web app, Shield stops the surge.

⚠ Common exam trap

Candidates often confuse AWS Shield Advanced (Layer 3/4 DDoS protection) with AWS WAF (Layer 7 web exploit filtering), or mistakenly think Security Groups can inspect application-layer traffic when they only filter at the network and transport layers.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

AWS WAF

AWS WAF is a web application firewall that integrates directly with an Application Load Balancer to filter and monitor HTTP(S) requests. It provides managed rules to block common web exploits such as SQL injection and cross-site scripting (XSS), and allows you to define custom rules using conditions like IP addresses, HTTP headers, and URI strings. This makes it the correct choice for protecting the ALB-hosted application against these specific threats.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • AWS WAF

    Why this is correct

    AWS WAF is a web application firewall that protects against common web exploits like SQL injection and XSS. It integrates directly with ALB and allows custom rules to be defined.

  • AWS Shield Advanced

    Why it's wrong here

    AWS Shield Advanced provides enhanced DDoS protection at the network and transport layers, but it does not inspect application-layer payloads for SQL injection or XSS.

    When this WOULD be correct

    A company needs enhanced DDoS protection for a web application, including cost protection against scaling charges and access to the DDoS Response Team (DRT). The solution must work with CloudFront or ALB but does not require custom web application firewall rules.

  • Security Groups

    Why it's wrong here

    Security Groups act as virtual firewalls for EC2 instances, controlling inbound and outbound traffic based on IP addresses, ports, and protocols. They do not perform application-layer inspection.

    When this WOULD be correct

    A company wants to restrict inbound traffic to EC2 instances based on source IP addresses and ports, such as allowing only HTTP/HTTPS from specific IP ranges. Security Groups would be the correct service to implement this network-level access control.

  • AWS Firewall Manager

    Why it's wrong here

    AWS Firewall Manager is a security management service that enables you to centrally configure and manage firewall rules across accounts and resources. It does not directly provide web application firewall capabilities; it helps deploy WAF policies.

    When this WOULD be correct

    A company has multiple AWS accounts and wants to centrally deploy and manage AWS WAF rules across all accounts and resources, including ALBs. The question would specify a need for centralized policy management and compliance enforcement across an organization, making AWS Firewall Manager the correct answer.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The CLF-C02 exam frequently reuses these exact scenarios with slightly different constraints.

AWS WAFCorrect answer

Why this is correct

AWS WAF is a web application firewall that protects against common web exploits like SQL injection and XSS. It integrates directly with ALB and allows custom rules to be defined.

AWS Shield AdvancedWrong answer — click to see why

Why this is wrong here

AWS Shield Advanced provides DDoS protection, not application-layer filtering for SQL injection or XSS. It does not integrate directly with ALB for custom web exploit rules.

★ When this WOULD be the correct answer

A company needs enhanced DDoS protection for a web application, including cost protection against scaling charges and access to the DDoS Response Team (DRT). The solution must work with CloudFront or ALB but does not require custom web application firewall rules.

Why candidates choose this

Candidates may confuse Shield Advanced with WAF because both are security services, or assume 'advanced' protection includes application-layer filtering.

Security GroupsWrong answer — click to see why

Why this is wrong here

Security Groups act as a virtual firewall at the instance level, controlling inbound and outbound traffic based on IP addresses and ports. They cannot inspect application-layer traffic for web exploits like SQL injection or XSS, nor do they integrate with ALB for custom rule definitions.

★ When this WOULD be the correct answer

A company wants to restrict inbound traffic to EC2 instances based on source IP addresses and ports, such as allowing only HTTP/HTTPS from specific IP ranges. Security Groups would be the correct service to implement this network-level access control.

Why candidates choose this

Candidates may confuse Security Groups with a web application firewall, thinking they can filter HTTP requests, but Security Groups operate at the network layer and lack application-layer inspection capabilities.

AWS Firewall ManagerWrong answer — click to see why

Why this is wrong here

AWS Firewall Manager is a policy management service that centrally configures and manages firewall rules across accounts and resources, but it does not itself provide web application protection against SQL injection or XSS. It can manage AWS WAF rules, but the question asks for the service that directly protects against these exploits and integrates with the ALB, which is AWS WAF.

★ When this WOULD be the correct answer

A company has multiple AWS accounts and wants to centrally deploy and manage AWS WAF rules across all accounts and resources, including ALBs. The question would specify a need for centralized policy management and compliance enforcement across an organization, making AWS Firewall Manager the correct answer.

Why candidates choose this

Candidates may confuse Firewall Manager as a direct security service because its name suggests it manages firewalls, and they might think it provides the actual protection instead of being a policy management layer for other services like AWS WAF.

Analysis generated from the official CLF-C02blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

About these practice questions

Courseiva writes every CLF-C02 question from scratch — 988 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on CLF-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A company hosts a web application on Amazon EC2 instances behind an Application Load Balancer. The security team wants to protect the application from common web attacks such as SQL injection and cross-site scripting (XSS) at the edge, before the requests reach the application. The company wants to use pre-built rule sets maintained by AWS to quickly enable protection, and the solution should be fully managed with no servers to manage. Which AWS service should the company use?

medium
  • A.AWS Shield Advanced
  • B.Amazon GuardDuty
  • C.AWS WAF
  • D.AWS Network Firewall

Why C: AWS WAF is a fully managed web application firewall that helps protect web applications from common web exploits like SQL injection and cross-site scripting (XSS). It integrates with Application Load Balancers (ALBs) and allows you to use pre-built, AWS-managed rule sets (e.g., the AWS Managed Rules for SQL injection and XSS) to quickly enable protection at the edge, before traffic reaches the EC2 instances. This meets the requirement for a serverless, managed solution with no infrastructure to maintain.

Variation 2. A company hosts a critical e-commerce web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The security team is concerned about Layer 7 attacks, such as SQL injection and cross-site scripting (XSS). They also want to automatically block traffic from known malicious IP addresses. The company needs a managed web application firewall that integrates directly with the ALB. Which AWS service should the company use?

medium
  • A.AWS WAF
  • B.AWS Shield Advanced
  • C.Amazon GuardDuty
  • D.AWS Firewall Manager

Why A: AWS WAF is a managed web application firewall that protects web applications from common Layer 7 attacks, such as SQL injection and cross-site scripting (XSS), by inspecting HTTP/HTTPS requests. It integrates directly with an Application Load Balancer (ALB) to allow you to create custom rules that block or allow traffic based on request patterns, including automatically blocking traffic from known malicious IP addresses using managed IP reputation lists.

Variation 3. A company hosts a web application on AWS that uses Amazon CloudFront for content delivery and an Application Load Balancer (ALB) in front of Amazon EC2 instances. The security team wants to protect the application against common web exploits such as SQL injection and cross-site scripting (XSS). They need a managed service that can inspect incoming HTTP/HTTPS requests and block malicious traffic before it reaches the application servers. Which AWS service should the company use to meet these requirements?

medium
  • A.AWS WAF
  • B.AWS Shield Advanced
  • C.AWS Firewall Manager
  • D.Amazon Inspector

Why A: AWS WAF is a managed web application firewall that helps protect web applications from common web exploits like SQL injection and cross-site scripting (XSS). It integrates directly with Amazon CloudFront and Application Load Balancers (ALB) to inspect incoming HTTP/HTTPS requests and block malicious traffic before it reaches the application servers. This makes it the correct choice for the security team's requirement to filter and block specific attack patterns at the application layer.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CLF-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CLF-C02 exam.