AWS Certified Developer – Associate — Question 192

An application adds a processing date to each transaction that it receives. The application writes each transaction to an Amazon DynamoDB table by using the PutItem operation. Each transaction has a unique ID (transactionID). Sometimes the application receives transactions more than once.

A developer notices that duplicate transactions in DynamoDB have the latest processing date instead of the date when the transaction was first received. Duplicate records happen infrequently, and most of the transactions are unique.

What is the MOST cost-effective solution that the developer can implement to ensure that PutItem does not update an existing record?

Answer options

Correct answer: D

Explanation

The correct answer is D because using the attribute_not_exists(transactionID) condition ensures that the PutItem operation only succeeds if a transaction with that ID does not already exist, thus preventing updates to existing records. Option A is inefficient and incurs additional read costs, while B does not address the issue of duplicate transactions. Option C would allow updates for existing transactions, which is counterproductive in this scenario.