Composition Patterns: API Gateway, DynamoDB, S3, EventBridge, SQS
coreadvancedServerless architectures are assembled from a small set of repeating shapes. A synchronous API is API Gateway in front of Lambda in front of DynamoDB. Asynchronous work is an event source — S3, EventBridge, or SQS — invoking Lambda. The important design question in each shape is what happens when the function fails, because that answer differs per event source.
Think of it as
Lambda is glue between managed services, and the event source is what decides the retry and failure semantics. Choosing the source is therefore choosing the reliability model — not just choosing what triggers the code.
What we're doing: Stop a traffic spike from exhausting a relational database through Lambda.
- 1
- Lambda's scaling is a feature everywhere except in front of something that does not scale the same way. A connection pool is exactly that.
- 6
- Reserved concurrency turns Lambda into a bounded worker pool. The number comes from the downstream's capacity, not from the incoming rate.
Why this works: The most common serverless failure is not Lambda breaking — it is Lambda working perfectly and overwhelming something that cannot follow. A queue plus reserved concurrency converts an availability failure into a latency increase, which is almost always the better trade.
Chaining Lambdas synchronously to build a workflow
Wrong
Better
What you see: You pay for A and B to sit idle while C runs, the whole chain is bounded by one 15-minute timeout, and a failure in C means re-running everything.
Why: A synchronous invoke blocks the caller and bills for the waiting time, so a three-deep chain triples the cost of the slowest step. It also collapses three independent retry boundaries into one, which is exactly what an orchestrator or a queue exists to keep separate.
- Client
- leads to API Gateway (HTTPS)
- API Gateway — auth, throttling, routing
- leads to Lambda (sync) (invokes)
- Lambda (sync) — client waits; failures are visible
- leads to DynamoDB (reads/writes)
- DynamoDB — single-digit-ms reads and writes
- leads to EventBridge / SQS / S3 event (change events)
- EventBridge / SQS / S3 event — the asynchronous half
- leads to Lambda (async) (invokes)
- Lambda (async) — retries + DLQ decide correctness
What each event source gives you
Together
Remember: Synchronous: API Gateway → Lambda → DynamoDB, and the client owns retries. Asynchronous: an event source invokes Lambda and the source's rules own retries. Put a queue in front of anything that cannot scale like Lambda, and bound it with reserved concurrency.
See also: serverless operational limits · when not to use serverless · invocation models

