来自同一 table 的多个 DynamoDB 流由同一 Lambda 函数使用

Multiple DynamoDB streams from same table consumed by same Lambda function

我有一个 Lambda 函数,可以将 DynamoDB 流消息推送到 SNS。如果我把 batch size 设为 10,它可以合并两个不同流的记录吗?

例如:Stream1 有一个包含 2 个对象的数组,Stream2 也有一个包含 2 个对象的数组。如果我将批处理大小设置为 10,lambda 会创建 2 个批处理(每个流处理一个)还是将两个流的对象组合起来并将它们放在单个批处理下。假设两个流同时命中 Lambda。

来自DynamoDB Streams and AWS Lambda Triggers - Amazon DynamoDB

If you enable DynamoDB Streams on a table, you can associate the stream Amazon Resource Name (ARN) with an AWS Lambda function that you write. Immediately after an item in the table is modified, a new record appears in the table's stream. AWS Lambda polls the stream and invokes your Lambda function synchronously when it detects new stream records.

因此,Lambda 函数仅从单个 DynamoDB 流中检索消息。如果批处理大小配置为检索多条记录,这些记录将全部检索到来自同一流