What is the event source mapping in AWS Lambda?
Answer
An Event Source Mapping is a Lambda resource that reads from poll-based event sources and invokes Lambda with batches of records. Supported sources: Amazon SQS, Amazon Kinesis Data Streams, Amazon DynamoDB Streams, Amazon MSK (Kafka), self-managed Apache Kafka, MQ (ActiveMQ, RabbitMQ). Lambda polls the source, reads records up to the configured BatchSize (1–10,000 depending on source), and invokes the function with the batch. Key configuration: BatchSize — records per invocation; BisectOnFunctionError — halves the batch on failure to isolate bad records; MaximumRetryAttempts — retries before sending to DLQ; StartingPosition (TRIM_HORIZON = oldest, LATEST = newest) for stream-based sources; Destination on failure — send failed batches to SQS DLQ or SNS. Event source mappings enable Lambda to consume high-throughput streams efficiently without managing polling infrastructure.
Previous
How do you handle errors and retries in serverless functions?
Next
What are the security considerations for serverless applications?
More Serverless Architecture Questions
View all →- Intermediate How do you reduce cold start latency in serverless functions?
- Intermediate What is AWS Step Functions and when would you use it?
- Intermediate How do you handle state in serverless applications?
- Intermediate What is the Serverless Framework and how does it work?
- Intermediate How do you implement authentication in a serverless API?