Create an event source mapping to tell Lambda to send records from your stream to a Lambda function. You can create multiple event source mappings to process the same data with multiple Lambda functions, or to process items from multiple streams with a single function.
To configure your function to read from DynamoDB Streams in the Lambda console, create a DynamoDB trigger.
To create a trigger
Open the Functions page of the Lambda console.
Choose the name of a function.
Under Function overview, choose Add trigger.
Choose a trigger type.
Configure the required options, and then choose Add.
Lambda supports the following options for DynamoDB event sources.
Event source options
DynamoDB table – The DynamoDB table to read records from.
Batch size – The number of records to send to the function in each batch, up to 10,000. Lambda passes all of the records in the batch to the function in a single call, as long as the total size of the events doesn't exceed the payload limit for synchronous invocation (6 MB).
Batch window – Specify the maximum amount of time to gather records before invoking the function, in seconds.
Starting position – Process only new records, or all existing records.
Latest – Process new records that are added to the stream.
Trim horizon – Process all records in the stream.
After processing any existing records, the function is caught up and continues to process new records.
On-failure destination – An SQS queue or SNS topic for records that can't be processed. When Lambda discards a batch of records that's too old or has exhausted all retries, Lambda sends details about the batch to the queue or topic.
Retry attempts – The maximum number of times that Lambda retries when the function returns an error. This doesn't apply to service errors or throttles where the batch didn't reach the function.
Maximum age of record – The maximum age of a record that Lambda sends to your function.
Split batch on error – When the function returns an error, split the batch into two before retrying. Your original batch size setting remains unchanged.
Concurrent batches per shard – Concurrently process multiple batches from the same shard.
Enabled – Set to true to enable the event source mapping. Set to false to stop processing records. Lambda keeps track of the last record processed and resumes processing from that point when the mapping is reenabled.