1.Composition Patterns: API Gateway, DynamoDB, S3, EventBridge, SQS
Serverless 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.
Key features
- Synchronous shape: API Gateway → Lambda → DynamoDB, where the client sees the failure and retries are the client's problem
- Asynchronous shape: an event source invokes Lambda, and failures are retried by the service according to that source's rules, then sent to a dead-letter or on-failure destination
- S3 event notifications invoke a function per object event, which makes "process on upload" a wiring decision rather than a polling loop
- EventBridge routes events by rule to many targets, so adding a consumer does not change the producer
- SQS gives you a buffer and a natural concurrency limit — the queue absorbs a burst that would otherwise translate directly into Lambda concurrency
- A queue in front of Lambda is how you protect a downstream that cannot scale, such as a relational database with a bounded connection count — and mixing shapes is normal, with the API writing to DynamoDB and a stream or rule fanning the change out to asynchronous work
What each event source gives you
- 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
Signature
sync: APIGW → Lambda → DynamoDB · async: S3 / EventBridge / SQS → Lambda → DLQ · queue + reserved concurrency for bounded downstreams
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.