8
8
Table of Contents

As our web application footprint expanded, we realized that static filtering alone was no longer enough to protect the platform against modern traffic abuse patterns. We needed a security design that could respond to behavioral signals, not only signature-based payloads, while still preserving smooth performance for legitimate users. 

Our production implementation focused on AWS WAF because it allowed us to enforce policy at the edge, before malicious requests could consume application resources. The key objective was clear: Reduce abusive external traffic without interrupting trusted internal traffic that supports monitoring, integrations, and operational workflows. 

To achieve this, we implemented a layered strategy that combined custom blocking logic, rate-based controls, internal IP whitelisting, and AWS managed rule groups. Instead of treating each rule as an isolated control, we intentionally designed the rule ordering so that trusted flows are handled first, and unknown traffic is progressively filtered through stricter checks. This approach gave us better security outcomes and a more stable operational model.

Why Rate Limiting Matters for Web Applications

Many attacks begin as high-frequency traffic behavior rather than explicit exploit payloads, which means they can appear harmless in isolated request analysis while still causing serious operational impact. Brute-force attempts, endpoint scraping, token enumeration, and reconnaissance bursts often stem from repeated requests originating from a limited set of IPs. If such traffic is allowed to scale unchecked, it can degrade user experience, increase backend load, and hide more targeted attack attempts inside noisy request streams. 

Rate limiting gives security teams strong behavioral control by enforcing request thresholds at the edge and reducing abuse before it reaches core services. In our case, we configured AWS WAF to block traffic when a single source exceeded 1000 requests per IP in the configured evaluation window. That threshold was selected after traffic baseline review so it would suppress abusive spikes without harming normal user interaction patterns. The result was a measurable reduction in noisy traffic and a clearer separation between legitimate traffic variation and malicious request bursts.

Our Implementation Approach in AWS WAF

We approached implementation as a policy architecture exercise, not just a rule creation task, because control sequencing matters as much as control selection.

The first design principle was to explicitly protect trusted internal traffic before evaluating external threat logic, which prevented accidental disruption to business-critical dependencies. The second principle was to use layered enforcement so that obvious malicious patterns are dropped quickly while more ambiguous behavior is evaluated by rate and managed by intelligence controls. The third principle was to roll out high-impact rules in observation mode first, then promote to block mode only after log validation.

This process helped us avoid false-positive incidents and gave teams confidence in production enforcement decisions. We also aligned logging, dashboards, and alerting with each rule category so operational tuning could happen continuously rather than reactively. By combining technical enforcement with disciplined rollout governance, we converted WAF from a static configuration into an active security control plane.

  • Custom blocking rules for known high-risk request patterns.
  • Rate-based control for high-volume abuse from single IP sources.
  • Internal IP whitelisting for trusted service and enterprise traffic.

AWS managed rule groups for broad threat detection coverage.

1. Custom Blocking Rules for Known Malicious Patterns

Before enabling broad behavioral controls, we implemented precise custom filters for request patterns that have little to no legitimate business value in our environment. This included known sensitive paths, repository exposure attempts, and technology probe signatures that are commonly used in reconnaissance campaigns. Blocking these requests early improved signal quality in our logs because low-effort scanning traffic was reduced before deeper analysis stages. It also lowered unnecessary load on backend services by preventing pointless request traversal through application components. We treated these rules as high-confidence controls, but still validated hit patterns during early rollout to confirm no legitimate path dependencies were overlooked. This gave us a clean first layer that removed predictable noise and made subsequent security tuning more effective. In practical terms, custom rules became the fast rejection layer that complements dynamic controls such as rate limiting.

  • Sensitive administrative URI paths.
  • Requests targeting exposed repository artifacts like .git.
  • Stack-specific crawl patterns not used by our application runtime.

2. Rate Limiting Rule for Abuse Control

Cloud Rate limiting was the central control in this implementation because it addresses abusive intent even when individual payloads do not look overtly malicious. We created a rate-based AWS WAF rule that tracks request volume per client source and enforces a block action at the threshold of 1000 requests per IP.

To reduce rollout risk, we first evaluated the rule in monitoring mode on ‘COUNT’ action and analyzed observed hit patterns against expected traffic baselines. Once we confirmed the threshold behavior was aligned with production traffic, we promoted the rule to ‘BLOCK’ mode and monitored the impact through dashboards and alerting. This staged activation approach helped us avoid user-facing regressions while still moving quickly toward stronger enforcement.

Over time, rate control became one of the most operationally valuable protections because it reliably reduced repetitive traffic abuse during burst events. It also improved analyst efficiency by turning diffuse traffic spikes into clear policy-triggered events.

  • Per-source request rate tracking.
  • A threshold of 1000 requests per IP.
  • Progressive rollout from Count to Block after validation.

3. Internal Request Whitelisting

A critical requirement in our design was preserving reliability for internal systems that must continue functioning during any external attack event. 

Internal services such as health-check pipelines, enterprise integrations, and controlled automation can naturally produce traffic profiles that resemble high-volume behavior under specific conditions. Without explicit exceptions, generic enforcement controls could inadvertently affect these trusted dependencies and create operational instability. 

To prevent this, we created IP allowlists using Amazon Web Services WAF IP sets and placed allow rules at a higher priority than rate and threat rules. This ensured trusted internal CIDR ranges were evaluated first and passed through without unnecessary friction. We also implemented governance around allowlist updates so additions remain intentional, documented, and periodically reviewed for relevance. That combination of explicit trust boundaries and rule precedence gave us strong external protection while maintaining internal continuity.

  • Corporate NAT egress ranges.
  • Monitoring and health-check sources.
  • Approved integration and platform service IP ranges.

Extending Beyond Rate Limiting: Additional Controls

Rate limiting materially improves resilience, but by itself, it does not provide comprehensive protection against diverse web attack paths. We therefore extended the control set with geofencing and managed rule intelligence to improve both preventive coverage and detection depth. This broader model allowed us to address traffic context, payload risk, and source reputation in a coordinated manner. Instead of enforcing every rule with immediate block actions, we used a risk-weighted strategy where uncertain signals could start in count or challenge mode. That gave us cleaner telemetry and reduced false positives before strict enforcement was applied. The overall effect was a policy framework that is both defensive and adaptable, which is essential for long-term web security operations.

GeoFencing

Geofencing helps to reduce irrelevant exposure by aligning traffic acceptance with your actual business geography. Where traffic originated from regions with no valid customer or partner footprint, one can apply block or challenge policies based on risk tolerance and observed request behavior. 

For regions with legitimate demand, use more conservative enforcement and monitor anomalies before adjusting controls. This prevents overblocking while still shrinking the attack surface in a measurable way. Geo controls are especially useful during burst events where request origins are clustered in unexpected locations. By combining geography with rate and signature context, we can improve decision quality and reduce unnecessary alert fatigue. Geofencing must not be treated as a Standalone Defense, but as a high-value contextual layer in the overall Amazon WAF architecture.

AWS Managed Rule Groups

AWS managed rule groups gave us broad baseline protection against common web threats without requiring constant manual signature maintenance. These managed controls helped detect and block SQL injection attempts, cross-site scripting payloads, suspicious input constructs, and known high-risk source categories. We still tuned rule actions thoughtfully by using a phased model for rules that showed mixed confidence in early telemetry. High-confidence malicious matches were enforced as block actions, while ambiguous patterns were temporarily monitored to assess false-positive potential. This approach preserved security strength while maintaining application reliability and user experience. Managed rules also improved operational consistency because updates and improvements are continuously delivered as part of the managed service. In practice, they became a strong force multiplier that complemented our customs and behavioral controls.

  • SQL injection detection.
  • Cross-site scripting protection.
  • Known bad input signatures.
  • Anonymous and reputation-based source intelligence.
  • Linux and Unix exploit pattern defenses.

Bot and Reputation Awareness

Not all suspicious traffic should be blocked immediately, especially when the behavior is anomalous but not conclusively malicious. For such cases, we used count or challenge modes to gather telemetry and validate risk before applying hard enforcement. This reduced false-positive risk and gave security teams better context for tuning thresholds and action policies. Reputation-aware controls also helped prioritize attention toward sources with a higher likelihood of abuse. Over time, this improved the quality of both automated responses and analyst-led investigations. The key benefit was confidence, since enforcement decisions were backed by evidence rather than assumption. That discipline made our AWS WAF policy more robust and easier to evolve.

Generic Must-Have WAF Rule Guide

For teams building a production-ready web ACL baseline, the following controls are essential and should be implemented with clear rule precedence and observability:

  • Associate web ACLs across all internet-facing entry points consistently.
  • Place trusted internal allowlist rules at top priority.
  • Apply rate-based protection for abuse-prone paths and overall traffic.
  • Enable managed rule groups for common exploits and reputation coverage.
  • Use geo controls where business traffic boundaries are well defined.
  • Harden sensitive paths, methods, and mutation endpoints explicitly.
  • Inspect headers, query strings, and bodies for malicious payload signals.
  • Enable full logging, dashboards, and alerting for continuous tuning.
  • Roll out new rules in Count mode before promoting to Block.
  • Maintain exception governance with documented owner and expiry review.

Conclusion

Rate limiting remains one of the highest-leverage controls for public web applications when implemented with careful precedence and internal trust exceptions. When combined with AWS managed protections, geofencing, and structured rollout governance, it can significantly reduce external abuse without compromising service continuity. The real value comes from treating WAF as a continuously tuned control plane backed by logs, telemetry, and periodic review. Organizations that adopt this layered approach typically gain stronger security outcomes and clearer operational predictability. Our experience confirmed that protection and reliability can coexist when policy design is intentional and context-aware. This is the model we recommend for teams looking to mature web application defense in production environments.

12
Let's discuss your cloud challenges and see how CloudKeeper can solve them all!
Meet the Author
  • Aryan Kulshrestha
    DevOps Engineer

    Aryan is a cloud infrastructure and DevOps enthusiast with a sharp focus on cloud cost optimization and automating complex, manual workflows across AWS and Azure.

Leave a Comment

Speak with our advisors to learn how you can take control of your Cloud Cost