exam questions

Exam AWS Certified Developer Associate All Questions

View all questions & answers for the AWS Certified Developer Associate exam

Exam AWS Certified Developer Associate topic 1 question 243 discussion

Exam question from Amazon's AWS Certified Developer Associate
Question #: 243
Topic #: 1
[All AWS Certified Developer Associate Questions]

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?

  • A. Call the GetItem operation first to confirm that the record does not exist. Then call PutItem.
  • B. Enable the TTL attribute on the DynamoDB table.
  • C. Implement a conditional put by using the attribute_exists(transactionID) condition expression.
  • D. Implement a conditional put by using the attribute_not_exists(transactionID) condition expression.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
rcaliandro
1 year, 11 months ago
Selected Answer: D
It is D. Since we can have multiple rows with the same ID but different date, in order to avoid to overwrite the wrong row we have to use a Conditional Write. So, we can call the put_item operation only if the transactionID doesn't exists (attribute_not_exists(transactionID))
upvoted 2 times
...
OtavioC
2 years, 1 month ago
Selected Answer: D
The MOST cost-effective solution that the developer can implement to ensure that PutItem does not update an existing record is D. Implement a conditional put by using the attribute_not_exists(transactionID) condition expression. By using the attribute_not_exists condition expression in the PutItem operation, you can ensure that a new item is only added to the table if the item with the specified primary key does not already exist in the table. This approach is cost-effective because it eliminates the need to call GetItem to confirm that the record does not exist, which incurs additional read capacity units (RCUs). Option B is not a solution to prevent PutItem from updating an existing record. It is used to automatically delete expired items in a DynamoDB table. Option C is also a possible solution, but it requires additional read capacity units (RCUs) to check if the record exists before inserting a new item. Therefore, option D is the most efficient and cost-effective solution to prevent PutItem from updating an existing record. By: GPT
upvoted 2 times
...
JuanFe
2 years, 2 months ago
It's clearly option D.
upvoted 2 times
...
sichilam
2 years, 4 months ago
Can be A too. They are talking about C# code, not AWS CLI
upvoted 2 times
pancman
2 years, 4 months ago
That wouldn't be the most cost-effective option. Hence, the answer is D.
upvoted 2 times
...
...
by116549
2 years, 5 months ago
Seems like D as we do not want the entry to be overwritten: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ConditionExpressions.html The PutItem operation overwrites an item with the same key (if it exists). If you want to avoid this, use a condition expression. This allows the write to proceed only if the item in question does not already have the same key. aws dynamodb put-item \ --table-name ProductCatalog \ --item file://item.json \ --condition-expression "attribute_not_exists(Id)"
upvoted 4 times
tony554556
2 years, 4 months ago
thanks for that
upvoted 1 times
...
...
michaldavid
2 years, 6 months ago
Selected Answer: D
This should be D
upvoted 1 times
...
k1kavi1
2 years, 6 months ago
Selected Answer: D
Choosing D
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...