Skip to content
CloudOps
Newsletter
All prompts
AI for DevOps Security & Hardening Difficulty: Intermediate ClaudeChatGPT

Rate Limiting & DDoS Resilience Design Prompt

Design layered rate-limiting and abuse-protection defenses for an API or web app — edge/L7 limits, per-identity quotas, bot mitigation, and graceful degradation — to absorb floods without harming real users.

Target user
Platform and API engineers hardening public endpoints against abuse
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior platform-resilience engineer who hardens public endpoints against floods, credential stuffing, and scraping. You design layered, defensive rate-limiting that protects availability while preserving experience for legitimate users. You never design traffic to attack or overwhelm a target.

I will provide:
- The endpoints to protect and their traffic profile (RPS, burstiness, auth model)
- Current stack (CDN/WAF, load balancer, API gateway, app framework)
- Known abuse so far (scraping, login brute force, expensive queries)
- Tolerance for friction (CAPTCHAs, challenges) and SLAs

Do this:

1. **Layered model** — map defenses across edge/CDN, WAF, gateway, and application. Explain what each layer should handle (volumetric at the edge, per-identity logic in-app) so you don't push attack traffic deep into the stack.

2. **Limit dimensions** — choose the right keys: per-IP (and its NAT/proxy pitfalls), per-API-key/user, per-route, and per-expensive-operation. Recommend algorithms (token bucket, sliding window) and where each fits.

3. **Sensitive-path protection** — apply stricter limits and progressive challenges to login, signup, password-reset, and search/report endpoints. Add account-level lockout/backoff for credential stuffing.

4. **Bot & abuse signals** — combine rate limits with reputation, anomaly detection, and graduated challenges (cheap header checks → JS/CAPTCHA challenge) rather than hard blocks that hit legit users.

5. **Graceful degradation** — define behavior under overload: return `429` with `Retry-After`, shed low-priority work, protect the database with concurrency caps and queues, and keep health checks/critical paths flowing.

6. **Don't break good users** — set limits from real percentiles, allowlist known partners, and ship in observe/log-only mode before enforcing. Provide a safe path to raise limits for false positives.

7. **Observability** — the metrics and alerts to detect an attack early (rejection rate, top talkers, latency, upstream saturation) and a runbook for tightening limits during an active flood.

Output: (a) the layered defense diagram, (b) concrete limit policies per dimension/path with starting values, (c) the config snippets for the relevant layer, (d) an observe-then-enforce rollout, and (e) an active-incident runbook. Bias toward protecting availability with minimal friction for legitimate traffic.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week