Posted On: Jun 30, 2023

Amazon DynamoDB now simplifies and lowers the cost of handling failed conditional writes by providing a copy of the item as it was during the failed write attempt. This lets you easily determine the cause of the condition error and then respond to failed conditional writes without having to perform a separate read operation to retrieve the item.

Previously, condition check errors in single write operations did not return a copy of the item in the event of a condition check error. A separate read request was necessary to get the item and investigate the cause of the error. Now with the ReturnValuesOnConditionCheckFailure parameter, DynamoDB error messages can include a copy of the item as it was during the write attempt at no additional cost.

The new parameter is available in all AWS Regions and supported in all the AWS SDKs, the DynamoDB APIs, the AWS CLI, and PartiQL for DynamoDB. To get started, add the parameter to your PutItem, UpdateItem, or DeleteItem operations and set the value to ALL_OLD. To learn more about condition checks, please see the following page.