- Newest
- Most votes
- Most comments
When using the BatchWriteItem API to write 3 items of 100 bytes each, you would be charged for 3 Write Capacity Units (WCUs), not 1 WCU.
The BatchWriteItem operation processes each item in the batch as an individual PutItem or DeleteItem request. DynamoDB calculates the consumed capacity for each item separately, even though they are sent in a single API call.
For write operations, DynamoDB charges one write unit for each item up to 1 KB in size. Even though each of your items is only 100 bytes, which is less than 1 KB, DynamoDB rounds up the size of each item to the next 1 KB boundary for capacity calculation purposes.
So, in your case:
- Item 1 (100 bytes): 1 WCU
- Item 2 (100 bytes): 1 WCU
- Item 3 (100 bytes): 1 WCU
Total: 3 WCUs
It's important to note that while BatchWriteItem can improve efficiency by allowing you to write multiple items in a single API call, it doesn't reduce the number of write capacity units consumed. Each item still consumes capacity as if it were written individually.
This pricing model applies regardless of whether you're using provisioned capacity or on-demand capacity mode. In on-demand mode, you would be billed for 3 write request units for this operation.
Sources
DynamoDB read and write operations - Amazon DynamoDB
BatchWriteItem - Amazon DynamoDB
Relevant content
asked 5 years ago
asked 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
