I have a use case where we don't get that many cases where there are list of entries in a single request to be updated and mostly, it is the case where only a single entry is requested to be updated. But in future, this might grow and hence I was thinking of using BatchPutItem instead of PutItem.
From a monetary cost perspective, it shouldn't matter - the WCUs consumed are the same. The benefit of the Batch API is that fewer requests go over the wire and thus reduce the overall latency for writing multiple items.
The error handling is different between the two APIs and it requires a bit of additional complexity to deal with BatchPutItem
. Even if the BatchPutItem
request is successful, individual item writes may have failed and you need to inspect the response from the API and retry and failed writes yourself.
The regular PutItem
would fail in a more straightforward way by returning an error / raising an exception.
This is just something to keep in mind and if you're going to use BatchWriteItem
anyway, you'll have to build logic for that in any case and this wouldn't be a drawback.
tl;dr: Using BatchWriteItem
with a single item should have no drawbacks in your case, because you'll have to build the retry logic anyway.