What are Lambda event source mappings?
Learn how Lambda polls queues and streams, creates batches, scales consumers, handles partial failures, and protects ordered processing.
What are Lambda event source mappings?
A Lambda event source mapping is a managed resource that reads records from a supported queue or stream, groups them into batches, and invokes a Lambda function with those records. The mapping owns polling and provides controls for batching, concurrency, filtering, retry behavior, and failure handling.
How this topic fits
Compute
Understand Lambda execution, scaling, concurrency, packaging, event sources, cold starts, and when serverless containers are the better fit.
The mapping is the consumer
For poll-based sources such as Amazon SQS, DynamoDB Streams, and Kinesis Data Streams, Lambda pollers retrieve records and invoke the target function. This differs from push-style services that directly invoke a function through its resource policy.
The source determines important semantics. Queues hide in-flight messages with a visibility timeout; streams retain ordered records in partitions or shards and allow multiple consumers to read them.
Balance batching, latency, and efficiency
Batch size and batching windows can reduce invocation overhead and improve throughput, but larger batches increase per-invocation work and can delay individual records. Payload limits can also cause a batch to contain fewer records than the configured maximum.
Make timeout, memory, visibility, and retry settings consistent with the slowest realistic batch. Load-test skewed record sizes and slow downstream calls rather than only uniform happy-path data.
Handle batch failures without replaying good work
A failed batch can be retried, and duplicate records can occur. Where supported, partial batch responses let the function report failed records so successfully processed records do not all need to return.
The handler must make each record idempotent and preserve ordering requirements. Poison records need a finite recovery path through age limits, retry limits, destinations, or a dead-letter queue appropriate to the source.
Control consumer scale and backpressure
Queue consumers can add pollers and concurrency as backlog grows, while stream concurrency is tied to shards or partitions and configured parallelization. Filtering can remove irrelevant events before they consume function capacity.
Set maximum concurrency or reserved concurrency when a downstream system cannot absorb the source's full rate. Watch iterator age or oldest-message age to distinguish healthy throughput from a growing recovery problem.
Go deeper with AWS
Read the primary AWS documentation behind the service definitions and architecture guidance in this guide.
Next steps
Continue with the concepts that most directly shape this decision.
What is Amazon SQS?
Learn how SQS queues decouple producers and consumers, how visibility and acknowledgment work, and when to choose Standard or FIFO queues.
What is Kinesis Data Streams?
Learn how Kinesis captures ordered real-time records, how shards and partition keys affect scale, and how multiple consumers process a retained stream.
Questions about this topic
Browse all serverless concepts
Explore compute, APIs, events, workflows, data, security, reliability, operations, delivery, and AI from one connected AWS serverless learning path.
What is serverless?
Learn what serverless computing means, how it works on AWS, what the cloud provider manages, and which trade-offs still belong to your team.
What is AWS Lambda?
Understand how AWS Lambda runs code, how functions are invoked, where permissions and state live, and when Lambda is a good compute choice.
What is serverless architecture?
Learn how managed compute, APIs, events, queues, workflows, data, identity, and observability fit together in a serverless architecture on AWS.
AWS serverless security
A practical guide to identity, least privilege, event validation, secrets, data protection, dependencies, and incident visibility in AWS serverless systems.
What is agentic AI?
Learn what makes an AI system agentic, how models, tools, memory, orchestration, identity, and evaluation fit together, and where serverless patterns help on AWS.
What is cloud computing?
Understand how on-demand infrastructure and managed services change the way teams provision, scale, pay for, and operate software systems.
What is event-driven architecture?
Learn how producers, routers, and consumers communicate through events, and how to design schemas, delivery, retries, and ownership deliberately.
What is a serverless API?
Understand the request path, authentication, routing, compute, data, throttling, observability, and failure controls behind a serverless API on AWS.
What are serverless workflows?
Learn when explicit workflow state improves retries, branching, parallel work, human approval, visibility, and recovery in distributed applications.
What is Amazon API Gateway?
Learn how API Gateway creates, publishes, secures, monitors, and operates HTTP, REST, and WebSocket APIs for AWS and external backends.
What is Amazon EventBridge?
Understand EventBridge event buses, rules, pipes, schemas, targets, schedules, permissions, delivery, and recovery in event-driven AWS systems.
Make the next serverless decision explicit.
Explore focused products for repeatable work, or bring the architecture decision that needs context and experienced review.