DVA-C02 Question 193
Single answerYou are developing a serverless application using AWS Lambda and Amazon DynamoDB. Your application requires high availability and durability for storing user data, and you need to ensure that writes to the DynamoDB table are immediately available for strong consistency. How can you achieve this?
- A
Enable DynamoDB Streams on the table to ensure strong consistency.
- B
Configure the DynamoDB table to use On-Demand Capacity Mode.
- C
Use the DynamoDB
GetItemoperation with theConsistentReadparameter set to true. - D
Enable Multi-AZ replication for the DynamoDB table.
Show answer and explanation
Correct answer: C
Explanation
To achieve strong consistency in DynamoDB, you must use the GetItem or Query operation with the ConsistentRead parameter set to true. By default, DynamoDB uses eventual consistency for reads, but this parameter ensures the read is performed against the leader node for up-to-date and strongly consistent data.
- A. Incorrect.
DynamoDB Streams are used for capturing changes to the table and do not influence read consistency. This option is incorrect.
- B. Incorrect.
On-Demand Capacity Mode scales the read and write throughput based on demand but does not guarantee strong consistency. This option is incorrect.
- C. Correct.
The
ConsistentReadparameter ensures that theGetItemoperation reads from the leader node, providing strong consistency. This is the correct answer. - D. Incorrect.
DynamoDB inherently provides Multi-AZ replication for high availability and durability, but it does not directly control strong consistency. This option is incorrect.