Maximum size of item is 400 KB. With PutItem ONLY 1 item can be written; with BatchWriteItems, you can write upto 25 items.
Is a single item operation that is used for writing an item to the table. The default behavior of the PutItem operation is that if the item identified by primary key does not exist then it is created otherwise the item is updated. Let’s go over the operation’s parameters:
TableName is a required parameter for the write operation.
Item is a required JSON structure that has the values for key and non-key attributes. Data type descriptors are needed for all attribute value definitions.
ConditionExpression is an optional parameter that defines an expression to be evaluated before actual write on the table. More on this below.
ExpressionAttributeNames & ExpressionAttributeValues are optional parameters that provide names and values for the placeholders in the ConditionExpression. Needed only if the ConditionExpression is provided.
aws dynamodb put-item \
--table-name Employee \
--item '{
"LoginAlias": {"S": "irenes"},
"FirstName": {"S": "Irene"},
"LastName": {"S": "Smith"},
"ManagerLoginAlias": {"S": "mateoj"},
"Designation": {"S": "developer"},
"Skills": {"SS": ["python","aws"]}
}'
With this API, application may send up to 25 items for write to one or more tables. DynamoDB processes each item by invoking PutItem with item data. It then returns a JSON - all failed writes are sent back to the application in an attribute UnprocessedItems attribute which is a collection. App must check the failed item writes and take appropriate action. Batch write item offers better performance compared to individual put item requests as it avoids the back & forth between the app and table which means lesser network overheads.
Each PutItem request in the batch is treated as an independent request and failure of one does not impact other item write requests in the batch.