Jun 24, 2024
AWS WAF - Protect Your Web Applications From Common Exploits
Explore how AWS WAF helps you protect your web applications against common web exploits and bots that can affect availability, compromise security, or consume excessive resources.
Author


Book a call
Table of Contents
Why AWS WAF?
AWS Web Application Firewall (WAF) is a security tool that helps you to protect the application against web attacks. WAF monitors and controls unusual bot traffic, and blocks common attack patterns, such as SQL Injection or Cross-site scripting, etc. It also lets you monitor the HTTP and HTTPS requests that are forwarded to an Amazon API Gateway API, Amazon CloudFront, or an Application Load Balancer.
How Does It Work?
- Amazon WAF allows you to control your content by using an IP address from where the request originates.
- Three things make Amazon WAF work – Access Control Lists (ACL), Rules, and Rule Groups.
- Amazon WAF manages Web ACL capacity units (WCU) for rules, rule groups, and web ACLs.
- Amazon WAF includes a full-featured API that you can use to automate the creation, deployment, and maintenance of security rules.
AWS WAF Features
- Protection Against Web Attacks: With minimum latency impact on incoming traffic, WAF AWS offers many rules to inspect any element of a web request. WAF AWS protects web applications against threats by filtering traffic according to the rules created.
- Establish Rules Accordingly: WAF AWS is a versatile and valuable tool for protecting the infrastructures of applications. This is because it allows users to establish rules according to their needs and vulnerabilities that they wish to stop. We can consider it a great solution to protect any web application environment at the enterprise level.
- Web traffic filtering: WAF allows users to create rules to filter web traffic. It filters IP addresses, HTTP headers, HTTP bodies, or URI strings from a web request.
- Flexible Integration With AWS Services: AWS Firewall offers easy integration with other AWS services like Amazon EC2, CloudFront, Load balancer, etc.
- Monitor Rules: Web Application Firewall AWS allows us to create rules and review and customize them to prevent unknown attracts.

Common Web Attacks
Before protecting your applications, you need to know about the most common web attacks.

Why AWS WAF?
How does AWS WAF block or allow traffic?
How Does AWS WAF Protect My Web Site or Application?
Filter web traffic
Prevent account takeover fraud
Administer AWS WAF with APIs
What are WAF Rules?
Getting Started With AWS WAF

Step 2: Give a Name: Type the name you want to use to identify this web ACL. After that, enter Description if you want (optional) and then hit Next.

Step 3: Add an AWS Managed Rules rule group: In the next step, you need to add rules and rule groups. Click on Add managed rule groups. You will land on a new page to manage the ruling group mentioned in snapshot 2.


- Regular rule: This rule protects the application from SQL injection attacks. It will check if the URI path contains an SQL injection.
- Rate-based rule: This rule blocks the requests made from the same IP address after they exceed a certain limit in a time period.

After that, check the added rules and hit Next.


Step 4: Configure Cloudwatch Metrics:

Step 5: Review WebACL Configuration: In the final step, check all the rules and managed groups and hit on create web ACL.


Finally, a message will pop up: You Successfully created web ACL: ACL-name.

Why We Switched to AWS WAF
Our client is from the banking domain so we need to secure the application from malicious activities as this can incur monetary losses. We have an architecture of six backend and admin-panel services running on ECS Fargate with load balancers. For this, we are using Postgres DB’s and ElastiCache for Redis cluster.
Incident: We were getting hack attempts like DDOS attacks, SQL injections etc on services to compromise the Database and hack our systems. So, we did a POC and got to know AWS WAF can be helpful for this.
Process and Rules Implemented
WAF WebACL for Admin Panel
- Goto WAF→ Region: Select region.
- Create WebACL → Name: Name the WebACL.

Rules
Clients_IPs_Paths:Clients_IPs_Paths → Create rule.3. DDOS:
DDOS attacks are attempts by an attacker to disrupt the availability of targeted systems.
For infrastructure layer attacks, you can use AWS services such as Amazon CloudFront and Elastic Load Balancing (ELB) to provide automatic DDoS protection.
Use rate-based rules
You can create blanket or a URI-specific rate-based rules to protect your web application against DDoS attacks
Create a blanket rate-based rule from the AWS WAF console
A blanket rate-based rule allows you to set a threshold for the number of requests IPs can make to your web application.
- Open the AWS WAF console.
- Select the Web ACL that doesn't have an RBR defined, then select Rate-based rule.
- Enter a Name for your rule.
- Enter a Rate limit. The rate limit is the maximum number of requests allowed in any five-minute period from any single IP address. After this limit is reached, the rate-based rule action is applied to the IP address. When the requests from the IP address fall below the limit, the action is discontinued.
Note: The rate limit threshold is a representation of how many requests from a single IP address are considered too much and potentially malicious. Otherwise you might block good requests. If you're not sure what limit to set, it's a best practice to set the rule action to count and monitor your request pattern. - For IP address to use for rate limiting, select Source IP address or IP address in header.
IP address in header: When a request comes through a CDN or other proxy network, the source IP address identifies the proxy and the original IP address is sent in a header. Use caution when using the IP address in header option because headers might be handled inconsistently by proxies. And, headers can be modified to bypass inspection.
Source IP address: For Criteria to count request towards rate limit, choose count requests that match the criteria of a rule statement.
- Set the rule action to count or block requests from IP addresses while their request counts are over the limit. The application and removal of the rule action might take effect a minute or two after the IP address request rate change.
- Select Add Rule.
- Select Next. Limits - we kept 100 request for 5 minutes.

CountryOriginrule:CountryOriginrule → Select Originate from a country in→Add country codes: Select countries → Create ruleAWS-AWSManagedRulesBotControlRuleSet:AWS-AWSManagedRulesAmazonIpReputationList:7. AWS-AWSManagedRulesAnonymousIpList:
https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-ip-rep.html
Process:
Add my managed rules → Anonymous IP list —>Edit rules: Allow or block request → Save rule.
AWS-AWSManagedRulesKnownBadInputsRuleSet:AWS-AWSManagedRulesPHPRuleSet:AWS-AWSManagedRulesSQLiRuleSet:aws-waf-logs-admin-xxxWAF WebACL for BE
- Goto WAF→ Region: Select region.
- Create WebACL → Name: Name the WebAcl.

Clients_IPs_Paths:Add my own rules and rule groups → Rule group —> Select Rule group added from top Paths →Name: Clients_IPs_Paths → Create rule
3. DDOS:
DDOS attacks are attempts by an attacker to disrupt the availability of targeted systems.
For infrastructure layer attacks, you can use AWS services such as Amazon CloudFront and Elastic Load Balancing (ELB) to provide automatic DDoS protection.
Use rate-based rules
You can create blanket or a URI-specific rate-based rules to protect your web application against DDoS attacks.
Create a blanket rate-based rule from the AWS WAF console
A blanket rate-based rule allows you to set a threshold for the number of requests IPs can make to your web application.
- Open the AWS WAF console.
- Select the Web ACL that doesn't have an RBR defined, then select Rate-based rule.
- Enter a Name for your rule.
- Enter a Rate limit. The rate limit is the maximum number of requests allowed in any five-minute period from any single IP address. After this limit is reached, the rate-based rule action is applied to the IP address. When the requests from the IP address fall below the limit, the action is discontinued.
Note: The rate limit threshold is a representation of how many requests from a single IP address are considered too much and potentially malicious. Otherwise you might block good requests. If you're not sure what limit to set, it's a best practice to set the rule action to count and monitor your request pattern. - For IP address to use for rate limiting, select Source IP address or IP address in header.
IP address in header: When a request comes through a CDN or other proxy network, the source IP address identifies the proxy and the original IP address is sent in a header. Use caution when using the IP address in header option because headers might be handled inconsistently by proxies. And, headers can be modified to bypass inspection.
Source IP address: For Criteria to count request towards rate limit, choose count requests that match the criteria of a rule statement.
- Set the rule action to count or block requests from IP addresses while their request counts are over the limit. The application and removal of the rule action might take effect a minute or two after the IP address request rate change.
- Select Add Rule.
- Select Next. Limits - we kept 100 request for 5 minutes.

CountryOriginrule:CountryOriginrule → Select Originate from a country in→Add country codes: Select countries → Create rule.AWS-AWSManagedRulesBotControlRuleSet:AWS-AWSManagedRulesAmazonIpReputationList:AWS-AWSManagedRulesAnonymousIpList:AWS-AWSManagedRulesKnownBadInputsRuleSet:AWS-AWSManagedRulesPHPRuleSet:AWS-AWSManagedRulesSQLiRuleSet:aws-waf-logs —> Save.aws-waf-logs-be-xxxSumming Up
Subscribe to Our Newsletter
Subscribe to RSS
Press & Media Hub RSS FeedRelated Articles.
More from the engineering frontline.
Dive deep into our research and insights on design, development, and the impact of various trends to businesses.

Jun 27, 2026
Building a Resilient Hybrid-Cloud Network with WireGuard HA, Route-Based Failover, and Deep Observability

Jun 19, 2026
We Built a 114-Second AWS-to-Azure Failover. Here’s What We Learned

Jun 12, 2026
Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions

Jun 8, 2026
Geeklego: The Open-Source Design System Built to Work With AI

May 18, 2026
Your Vibe Code Has No Memory. DESIGN.md Fixes That.

May 14, 2026