Why doesn't my Amazon DynamoDB GetItem operation return the latest data even though PutItem is successful?

2 minutos de lectura

When I write a record to a table, PutItem returns a successful HTTP 200 response. However, when I try to fetch the item in a read request, Amazon DynamoDB doesn't return the record.


This usually happens when you use an eventually consistent read to access an item immediately after writing the item to a table. GetItem provides an eventually consistent read by default. If you repeat your read request after a short time, the response should return the latest data in the table for that item.

If you want to retrieve the latest data as soon as the write request is successful, set the ConsistentRead parameter to true. This enables strongly consistent reads. Note the following about strongly consistent reads:

  • Strongly consistent reads might have higher latency.
  • Strongly consistent reads aren't supported on global secondary indexes.
  • Strongly consistent reads require twice as much throughput as eventually consistent reads. This means that strongly consistent reads cost twice as much as eventually consistent reads. For more information, see Pricing for provisioned capacity or Pricing for on-demand capacity.

For an example request that uses strongly consistent reads, see Retrieve item attributes.

Related information


Read consistency

OFICIAL DE AWSActualizada hace 2 años