Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
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.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More DevOps Security & Hardening prompts & error guides

Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.