Your application is experiencing DDoS attacks and bot traffic targeting your GCP-hosted APIs. How do you configure Cloud Armor WAF policies with rate limiting, bot management, and adaptive protection? Walk through a production-grade setup.
Quick Answer
Configure Cloud Armor security policies with preconfigured WAF rules (OWASP Top 10), rate-based throttling per IP, bot management with reCAPTCHA Enterprise integration, and enable Adaptive Protection for ML-based anomaly detection. Attach policies to backend services behind the Global HTTP(S) Load Balancer.
Detailed Answer
Cloud Armor Architecture
Cloud Armor operates at the edge of Google's global network, inspecting traffic before it reaches your backend services. It integrates with the Global External HTTP(S) Load Balancer (both Classic and Advanced) and can protect GKE Services, Cloud Run, Cloud Functions, and external backends via Internet NEGs. Cloud Armor policies consist of ordered rules evaluated from highest to lowest priority, with a default rule at priority 2147483647.
WAF Rules and OWASP Protection
Cloud Armor provides preconfigured WAF rule sets based on the OWASP ModSecurity Core Rule Set. These cover SQL injection (sqli-v33-stable), cross-site scripting (xss-v33-stable), local/remote file inclusion (lfi-v33-stable, rfi-v33-stable), and remote code execution (rce-v33-stable). In production, enable these in detection-only mode first, analyze logs for false positives, then switch to blocking. Custom rules using Cloud Armor's expression language can match on headers, paths, query parameters, and geographic origin.
Rate Limiting Strategy
Cloud Armor supports rate-based banning: when a client exceeds a threshold (e.g., 100 requests per 60 seconds), subsequent requests are blocked for a configurable ban duration. Rate limiting can be scoped per IP, per IP+path, or per HTTP header value (useful for API key-based limiting). For API endpoints, implement tiered rate limits: aggressive limits on authentication endpoints (10 req/min), moderate limits on API calls (100 req/min), and lenient limits on static content.
Bot Management and Adaptive Protection
reCAPTCHA Enterprise integration enables invisible bot detection without user friction. Cloud Armor can evaluate reCAPTCHA tokens and block requests with low scores. Adaptive Protection uses ML models trained on your traffic patterns to detect and alert on volumetric attacks, providing auto-generated rules that you can approve for deployment. This catches attacks that static rules miss, such as slow-rate application-layer DDoS.
Monitoring and Incident Response
Cloud Armor logs to Cloud Logging with detailed match information including which rule triggered, the request details, and the action taken. Create dashboards showing blocked request rates, top attacking IPs, and geographic distribution. Set up alerts for sudden spikes in blocked requests or Adaptive Protection alerts. During an active attack, use Cloud Armor's emergency IP denylist to rapidly block attacking ranges.