GKGulshan Kumar
HomeBlogHardening Your AWS Infrastructure with W
Security10 min read

Hardening Your AWS Infrastructure with WAF — A Practical Guide

GK
Gulshan Kumar
28 February 2025

Why WAF Matters


A Web Application Firewall inspects HTTP traffic before it reaches your application. It blocks malicious requests at the edge — SQL injection, XSS, DDoS floods — before they ever hit your EC2/EKS workloads.


Core Rule Groups I Applied


1. AWS Managed Rules


resource "aws_wafv2_web_acl" "main" {
  name  = "prod-waf"
  scope = "REGIONAL"

  rule {
    name     = "AWSManagedRulesCommonRuleSet"
    priority = 1
    override_action { none {} }
    statement {
      managed_rule_group_statement {
        name        = "AWSManagedRulesCommonRuleSet"
        vendor_name = "AWS"
      }
    }
  }
}

2. Rate Limiting

We capped requests at 2000 per 5 minutes per IP to neutralize brute force and credential stuffing.


3. Geo-blocking

Blocked traffic from regions we don't operate in, reducing noise by ~40%.


Impact


  • OWASP Top 10 threats mitigated at the edge
  • DDoS flood events absorbed without reaching backend
  • Zero false-positive incidents after 2 weeks of tuning
  • ← Back to Blog✉️ Discuss this post