Event-Driven Architecture with AWS Lambda
Instruction: Explain the role of AWS Lambda in an event-driven architecture.
Updated
Official answer
Lambda supplies bounded application processing in response to events. Producers publish facts or requests, transport services deliver them, and consumers apply business logic. Those components have separate failure and scaling behavior.
For example, an S3 object notification can lead to image processing. Alternatively, route work through a queue to buffer bursts and control consumption. A DynamoDB stream mapping polls change records and can send multiple records in one invocation. Not every event source invokes the function directly or one record at a time.
Define the event schema and version, operation identity, ordering needs and success criterion. Consumers must tolerate the delivery guarantees of the chosen source, including duplicates and, where relevant, out-of-order events. Store progress durably and commit required output before acknowledging success. Avoid notification loops when the consumer writes back to a triggering resource.
Backpressure, concurrency limits, retention and sink capacity bound throughput. Configure poison-event recovery and replay rather than assuming automatic scaling prevents loss or unlimited delay.
Measure producer-to-business-result latency, backlog age, completion counts, duplicates, failures and total cost. Lambda Duration and invocation count alone do not show whether every intended business event was handled correctly.