DVA-C02 Question 80
Select 3You are developing a serverless application using AWS Lambda and Amazon DynamoDB. Your application needs to perform CRUD (Create, Read, Update, Delete) operations on a DynamoDB table named 'Orders'. Which of the following AWS SDK methods should you use to correctly implement these operations?
- A
putItem for Create
- B
getItem for Read
- C
updateTable for Update
- D
deleteItem for Delete
- E
scan for Create
Show answer and explanation
Correct answers: A, B, D
Explanation
To implement CRUD operations with DynamoDB using AWS SDK, you use putItem for Create, getItem for Read, updateItem for Update (not updateTable), and deleteItem for Delete. scan is unrelated to Create operations, as it is designed for retrieving multiple items. Understanding the correct methods ensures efficient and accurate interaction with DynamoDB.
- A. Correct.
putItem is the correct SDK method to create a new item in a DynamoDB table.
- B. Correct.
getItem is the correct SDK method to retrieve a single item by its primary key from a DynamoDB table.
- C. Incorrect.
updateTable is used to modify the configuration of a DynamoDB table, such as changing its provisioned capacity, not for updating items.
- D. Correct.
deleteItem is the correct SDK method to delete an item from a DynamoDB table using its primary key.
- E. Incorrect.
scan is used to retrieve all items in a table or segment and is not suitable for creating new items.