Streams from DyanamoDB Mapper Single BatchSave operation triggering multiple events in lambda

Viewed 36

I am using Java to insert multiple items into DynamoDB using batchSave method. The table has Streams enabled. I want the streams to trigger the lambda just once for a single batchSave. Should I be using some other Method to push multiple items in the DB?

Thanks In Advance :)

2 Answers

This is not possible to guarantee at scale, as each DynamoDB partition will have its own shard in the stream. If you insert a batch you may see the items appear in different lambdas, as each item could belong to a different partition and wind up in a different stream.

In addition, streams can only process 6MB of data in a single invocation, while a BatchWriteItem operation can send 16MB of data.

My issue got resolved by increasing the batchSize which was 1 by default.

Related