Design an AWS Lambda system for traffic spikes with explicit availability and scaling limits.
Instruction: Outline your approach to designing a resilient and scalable system architecture using AWS Lambda, including how you would manage state, scale dynamically in response to traffic spikes, and ensure high availability.
Updated
Official answer
Place API Gateway in front of stateless Lambda request handlers. Keep durable state in a database with an explicit capacity and consistency design; local memory and temporary files may be reused but are not shared durable state. Use a queue and a job-status API for work that can finish after the HTTP response.
Estimate demand, then test bursts. For example, 500 requests/second with a mean duration of 0.2 seconds implies about 100 concurrent executions in steady state. This is a starting estimate, not a burst guarantee: tail latency, scaling rates, account quotas and downstream limits still matter. Apply admission control and bounded retries with jitter so a database slowdown does not amplify traffic.
Reserve concurrency to isolate critical handlers and cap pressure on dependencies. Provisioned concurrency can reduce initialization latency for requests using the configured version or alias, but overflow can use on-demand environments. It adds cost and cannot guarantee that every burst has zero cold starts.
Lambda manages execution across Availability Zones within a Region; the developer does not manually place separate copies in each AZ. Configure dependencies, networking and recovery accordingly. Cross-Region recovery is a separate design involving data replication, routing, consistency and tested recovery objectives.
Measure end-to-end latency, errors, throttles and backlog during load and dependency-failure tests. State the supported traffic envelope and failure behavior rather than promising unlimited real-time scaling.
Lambda resilience, reserved concurrency, provisioned concurrency