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
-
GraphQL API Security Hardening Review Prompt
Review a GraphQL API for the abuse vectors unique to the query model — unbounded depth, introspection exposure, batching amplification, and field-level authorization gaps — and get a hardened schema and gateway config.
-
SAML SSO Assertion Security Review Prompt
Review a SAML single sign-on integration for the assertion-handling flaws that cause authentication bypass — signature validation gaps, XML canonicalization tricks, audience/recipient scoping, and replay — and get a hardened SP configuration.
-
Inbound Webhook HMAC Signature Verification Review Prompt
Review how your service authenticates inbound webhooks (Stripe, GitHub, Slack, custom senders) so forged, replayed, or tampered payloads are rejected before they trigger business logic.
-
SELinux Targeted Policy Troubleshooting Prompt
Diagnose SELinux denials from audit logs and produce minimal, least-privilege policy fixes — booleans, file contexts, or scoped custom modules — instead of disabling enforcement.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
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.