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.