Study guide
Technical reference and lesson notes
Purpose of This Lesson
AWS WAF is a web application firewall used to inspect and filter web requests before they reach an application. Its central configuration object is a web ACL, which contains rules that evaluate request characteristics and apply actions such as allowing, blocking, or counting traffic.
For the AWS Certified CloudOps Engineer Associate (SOA-C03) context, recognize WAF when a web application is exposed through CloudFront, an Application Load Balancer (ALB), API Gateway, or AWS AppSync and needs protection from common web exploits such as SQL injection or cross-site scripting (XSS).
Key Concepts
Web ACLs
A web access control list (web ACL) protects a set of supported AWS resources. It contains rules that define:
- What part of a request to inspect
- Which condition constitutes a match
- What action to take when the condition is met
A web ACL can be associated with resources such as a CloudFront distribution, an Application Load Balancer, an API Gateway API, or an AWS AppSync GraphQL API.
Rules and Rule Groups
A rule contains a statement describing the inspection criteria and an action to apply when a request matches. Rules may be used individually or organized into rule groups for reusable or logically grouped protections.
Match Statements
A match statement compares a web request or its origin with conditions defined by the rule. The lecture identifies several types:
- Geographic match: Matches requests based on the geographic origin of the connection.
- IP set match: Matches addresses against a defined collection of IP addresses or IP ranges.
- Regular expression pattern set: Matches request content against a collection of regular expressions.
- Size constraints: Inspects whether request content meets specified size conditions.
- SQL injection detection: Identifies patterns associated with SQL injection attacks.
- String matching: Looks for specified strings in request data.
- Cross-site scripting detection: Identifies patterns associated with XSS attacks.
IP Sets and Regular Expression Pattern Sets
An IP set is a reusable collection of IP addresses and IP ranges used by an IP set match statement. This is useful when a rule needs to allow or block a known group of sources.
A regular expression pattern set is a collection of regular expressions that can be referenced when inspecting request content.
Rule Actions
When a request matches a rule, WAF can take one of these actions described in the lecture:
- Count: Count matching requests without allowing or blocking them based on that action. This is useful for observing how often a condition occurs.
- Allow: Permit the traffic to continue to the protected application.
- Block: Reject the request. The client receives an HTTP 403 Forbidden response.
Protected Resource Placement and Attack Protection
AWS WAF can be placed in front of several AWS application entry points:
- CloudFront: Protects a CloudFront distribution and the application served through it.
- Application Load Balancer: Protects applications running behind an ALB, including workloads backed by EC2 instances.
- API Gateway: Protects APIs exposed through API Gateway.
- AWS AppSync: Protects GraphQL APIs behind AppSync.
The placement decision follows the public entry point of the application. If users reach the application through CloudFront, ALB, API Gateway, or AppSync, WAF can inspect requests at that relevant integration point.
WAF is particularly relevant for common web exploit protection, including SQL injection and cross-site scripting. These attack types are strong recognition signals in an AWS architecture or exam scenario.
Exam- or Assessment-Relevant Takeaways
- Choose AWS WAF when the problem involves filtering web requests or protecting a web application from common web exploits.
- SQL injection and cross-site scripting are key WAF recognition terms.
- CloudFront, ALB, API Gateway, and AppSync are the resource integrations emphasized in this lesson.
- A web ACL is the resource-protection container; rules inside the web ACL define inspection and action behavior.
- An IP set is appropriate when matching a maintained collection of IP addresses or ranges.
- A regular expression pattern set is appropriate when matching request content against multiple regular expressions.
- Use a geographic match when the decision depends on where the request originates.
- Use Count when observing matching traffic is needed rather than immediately permitting or rejecting it.
- A matching Block action produces a 403 Forbidden response to the client.
- Do not confuse the inspection condition with the response behavior: the match statement determines whether the request matches, while the rule action determines what WAF does next.
Tool / Feature Decision Guide
| Requirement | WAF feature or approach |
|---|---|
| Protect a supported application entry point | Associate a web ACL with CloudFront, ALB, API Gateway, or AppSync |
| Group protection logic | Use rules within a web ACL; organize related rules into a rule group when appropriate |
| Allow or block known IP addresses or ranges | Use an IP set match statement |
| Match patterns defined with regular expressions | Use a regular expression pattern set |
| Restrict or permit traffic by origin region | Use a geographic match |
| Detect SQL injection patterns | Use a SQL injection match statement |
| Detect cross-site scripting patterns | Use a cross-site scripting match statement |
| Find a specific text value in request data | Use a string match statement |
| Inspect request size conditions | Use a size constraint statement |
| Observe matching traffic before making an enforcement decision | Use the Count action |
| Reject matching requests | Use the Block action; clients receive 403 Forbidden |
| Permit matching requests | Use the Allow action |
Common Traps / Misconceptions
- Treating WAF as a general network firewall: WAF focuses on web request inspection and filtering, including request content, headers, URI-related data, IP origin, geography, and related conditions.
- Forgetting the protected entry point: In a scenario, identify whether traffic enters through CloudFront, ALB, API Gateway, or AppSync before selecting the WAF integration.
- Confusing an IP set with a geographic match: An IP set contains explicitly defined IP addresses or ranges; geographic matching evaluates the connection’s geographic origin.
- Assuming Count blocks traffic: Count records matching requests for observation; it is not the same as the Block action.
- Overlooking the 403 result: A WAF Block action rejects the request and generates a 403 Forbidden response to the client.
- Confusing a rule with a web ACL: The web ACL protects the resource and contains rules. The rule contains the inspection statement and action.
- Using a regular expression pattern set for every content match: Use a regular expression pattern set when the matching requirement is based on regular expressions; a simple string match may be more appropriate for a specified text value.
Real-World Engineer / Analyst Notes
- Start troubleshooting by identifying the request path and the AWS service receiving the public request. That determines where the web ACL is relevant.
- Separate detection from enforcement. Count can help establish how frequently a condition occurs before changing behavior to Allow or Block.
- Keep reusable collections separate from rule logic where possible: IP addresses belong in IP sets, and reusable regular expressions belong in regular expression pattern sets.
- When analyzing a blocked request, check both the matching condition and the selected action. A request may be correctly detected but handled differently depending on whether the rule counts, allows, or blocks it.
- For architecture reviews, look for common web exploit requirements whenever an application is exposed through CloudFront, an ALB, API Gateway, or AppSync.
Quick Reference Summary
- AWS WAF: Web application firewall for filtering web requests.
- Web ACL: Collection of rules associated with supported application resources.
- Rule: Contains an inspection statement and an action.
- Rule group: A grouping of rules.
- IP set: Collection of IP addresses and ranges.
- Regular expression pattern set: Collection of regular expressions.
- Match statements: Define what request or origin condition WAF evaluates.
- Actions: Count, Allow, or Block.
- Block result: HTTP 403 Forbidden.
- Supported integrations emphasized here: CloudFront, ALB, API Gateway, and AppSync.
- Major exploit examples: SQL injection and cross-site scripting.
Flashcards
Q: A web application is served through CloudFront and needs protection from SQL injection and XSS. Which AWS feature should be evaluated?
A: AWS WAF, using a web ACL associated with the CloudFront distribution and rules that inspect for the relevant exploit patterns.
Q: What is the relationship between a web ACL, a rule, and a match statement?
A: The web ACL protects a set of resources and contains rules. Each rule includes a match statement that defines what to inspect and an action that defines what to do when the statement matches.
Q: When would you choose an IP set match instead of a geographic match?
A: Use an IP set match when the decision is based on specific IP addresses or ranges. Use a geographic match when it is based on the geographic origin of the connection.
Q: An operations team wants to observe requests matching a new condition without immediately rejecting them. Which action should it select?
A: Select Count. It counts matching requests for observation rather than applying the blocking behavior.
Q: What happens to a client when an AWS WAF rule uses the Block action and the request matches?
A: WAF rejects the request and generates an HTTP 403 Forbidden response to the client.
Q: When is a regular expression pattern set useful in AWS WAF?
A: It is useful when request inspection should compare content against a collection of regular expressions rather than one simple string.
Q: Which AWS entry points emphasized in this lesson can have AWS WAF protection?
A: CloudFront distributions, Application Load Balancers, API Gateway APIs, and AWS AppSync GraphQL APIs.
Q: What is the key difference between Count and Allow?
A: Count records matching requests for observation, while Allow forwards matching traffic through to the application.
Q: A rule must identify requests containing a particular text value. Which type of match statement is the most direct choice?
A: A string match statement, because the requirement is to look for specified text in request data.
Q: What type of WAF condition is appropriate when access should be limited according to the request’s region of origin?
A: A geographic match statement.
Q: What is the role of a rule group?
A: A rule group organizes multiple WAF rules so they can be used together rather than managing every rule only as an isolated item.
Q: What is the trap when a scenario mentions an ALB with EC2 instances behind it?
A: The presence of EC2 does not make WAF an EC2-level control in this scenario. The relevant web entry point is the ALB, which can be protected with a WAF web ACL.
Practice Questions
Question 1
A company exposes an API through API Gateway. Security requirements call for filtering requests that contain SQL injection or cross-site scripting patterns. Which solution best fits the requirement?
A. Attach a web ACL using AWS WAF to the API Gateway API
B. Create an IP set containing the API’s backend instance addresses
C. Use an ALB health check to reject malicious request content
D. Place the API behind an EC2 security group only
Correct answer: A. The decisive clues are API Gateway and web exploit filtering. AWS WAF web ACLs can protect APIs exposed through API Gateway and inspect for SQL injection and XSS patterns.
Question 2
An engineer has a list of IP addresses and IP ranges that should be matched by several WAF rules. Which feature should the engineer use?
A. Geographic match
B. IP set
C. Regular expression pattern set
D. Size constraint
Correct answer: B. An IP set is specifically a collection of IP addresses and ranges that can be referenced in an IP set match statement.
Question 3
A team wants to measure how many requests match a suspected attack pattern before deciding whether to reject them. Which WAF action should be used initially?
A. Block
B. Allow
C. Count
D. Geographic match
Correct answer: C. Count supports observation of matching requests without immediately applying an allow or block outcome.
Question 4
Users report that requests are rejected by AWS WAF. The rule action is Block. Which response should the troubleshooting team expect the clients to receive?
A. HTTP 200 OK
B. HTTP 301 Moved Permanently
C. HTTP 403 Forbidden
D. HTTP 503 Service Unavailable
Correct answer: C. The lecture identifies HTTP 403 Forbidden as the client response generated by the WAF Block action.
WordPress Metadata
Suggested Slug:
aws-waf-web-acls-rules-match-statements
Meta Description:
Study AWS WAF concepts for the SOA-C03 exam, including web ACLs, rule groups, match statements, actions, and integrations with CloudFront, ALB, API Gateway, and AppSync.
Tags:
AWS WAF, AWS Certified CloudOps Engineer, SOA-C03, web ACL, CloudFront, Application Load Balancer, API Gateway, AWS AppSync, SQL injection, cross-site scripting