Bird
0
0

An API Gateway integration request to DynamoDB uses this template:

medium📝 Debug Q6 of 15
DynamoDB - with Serverless
An API Gateway integration request to DynamoDB uses this template:
{
  "TableName": "Users",
  "Key": {
    "UserId": { "S": "$input.params('userId')" }
  },
  "UpdateExpression": "set Age = :age",
  "ExpressionAttributeValues": {
    ":age": { "N": "$input.params('age')" }
  }
}

What is the error in this template?
AMissing 'UpdateItem' as the operation type
BThe template is missing 'ReturnValues' parameter
CNo error; this is a valid UpdateItem request
DUsing 'Key' and 'UpdateExpression' together is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Review UpdateItem request requirements

    UpdateItem requires TableName, Key, UpdateExpression, and ExpressionAttributeValues.
  2. Step 2: Check the template fields

    All required fields are present; 'ReturnValues' is optional.
  3. Final Answer:

    No error; this is a valid UpdateItem request -> Option C
  4. Quick Check:

    UpdateItem needs Key + UpdateExpression [OK]
Quick Trick: UpdateItem needs Key and UpdateExpression together [OK]
Common Mistakes:
MISTAKES
  • Thinking 'ReturnValues' is mandatory
  • Believing Key and UpdateExpression cannot coexist
  • Expecting operation type in template

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes