DVA-C02 Question 78
Select 4You are developing a serverless application using AWS Lambda and Amazon DynamoDB. Your application requires the ability to create, read, update, and delete items in a DynamoDB table. Which combination of IAM permissions should you grant to your Lambda function to enable these operations?
- A
dynamodb:PutItem
- B
dynamodb:GetItem
- C
dynamodb:UpdateItem
- D
dynamodb:DeleteItem
- E
dynamodb:Scan
Show answer and explanation
Correct answers: A, B, C, D
Explanation
To perform CRUD (Create, Read, Update, Delete) operations on a DynamoDB table, the Lambda function must have the following IAM permissions: dynamodb:PutItem for creating items, dynamodb:GetItem for reading items, dynamodb:UpdateItem for updating items, and dynamodb:DeleteItem for deleting items. The dynamodb:Scan permission is not required for basic CRUD operations but is used when you need to retrieve multiple items by scanning the table.
- A. Correct.
Correct. The dynamodb:PutItem permission is required to create new items in a DynamoDB table.
- B. Correct.
Correct. The dynamodb:GetItem permission is required to read items from a DynamoDB table.
- C. Correct.
Correct. The dynamodb:UpdateItem permission is required to update existing items in a DynamoDB table.
- D. Correct.
Correct. The dynamodb:DeleteItem permission is required to delete items from a DynamoDB table.
- E. Incorrect.
Incorrect. The dynamodb:Scan permission is used to retrieve multiple items by scanning the entire table, but it is not necessary for basic CRUD operations.