How to set DynamoDB Read Consistency

0

Hi How do I configure strongly consistent read in DynamoDB? I can't find where to set strongly consistent and eventually consistent reads

Thank you

Aman
質問済み 1年前864ビュー
2回答
1

At the request level, you have the flexibility to specify whether you want to use strong consistency or eventual consistency for different methods. Strongly consistent reads are enabled by setting a parameter value, indicating to DynamoDB that the read operation should be served from the leader node, ensuring immediate and up-to-date data. On the other hand, eventual consistency allows the read to be served from any of the three nodes, which may have slightly delayed updates. This parameter value allows you to choose the desired consistency level for each specific method you call in DynamoDB.

An example using CLI:

Consistent Read

aws dynamodb scan \
--table-name Mytable \
--consistent-read

Eventually Consistent Read

aws dynamodb scan \
--table-name Mytable \
--no-consistent-read

In the SDK's, it uses the Boolean parameter ConsistentRead which you can set to True or False.

More info here in the docs.

profile pictureAWS
エキスパート
回答済み 1年前
  • Thank you so much Leeroy!!!

0
承認された回答

Hi, look at https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html

It provides following details:

*Strongly Consistent Reads Read operations such as GetItem, Query, and Scan provide an optional ConsistentRead parameter. If you set ConsistentRead to true, DynamoDB returns a response with the most up-to-date data, reflecting the updates from all prior write operations that were successful. Strongly consistent reads are only supported on tables and local secondary indexes. Strongly consistent reads from a global secondary index or a DynamoDB stream are not supported. *

profile pictureAWS
エキスパート
回答済み 1年前
profile picture
エキスパート
レビュー済み 1ヶ月前
  • Yes, but how can it be configured? I tried the UpdateTable but could not achieve it.

  • Thank you so much Didier

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン