Bird
0
0

In an AppSync resolver mapping template for DynamoDB, what does the following Velocity Template Language (VTL) snippet do?

medium📝 query result Q5 of 15
DynamoDB - with Serverless
In an AppSync resolver mapping template for DynamoDB, what does the following Velocity Template Language (VTL) snippet do?
{"version": "2018-05-29", "operation": "PutItem", "key": {"id": {"S": "$ctx.args.id"}}, "attributeValues": {"name": {"S": "$ctx.args.name"}}}
AUpdates only the name attribute of an existing item
BDeletes an item with the specified id from DynamoDB
CInserts or replaces an item with given id and name in DynamoDB
DQueries items with the given id from DynamoDB
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the operation field

    The operation is "PutItem", which inserts or replaces an item in DynamoDB.
  2. Step 2: Understand the key and attributes

    The key is set by id argument, and attributeValues sets the name attribute.
  3. Final Answer:

    It inserts or replaces an item with given id and name -> Option C
  4. Quick Check:

    PutItem = Insert or replace item [OK]
Quick Trick: PutItem replaces or inserts item in DynamoDB [OK]
Common Mistakes:
MISTAKES
  • Confusing PutItem with DeleteItem
  • Thinking it only updates attributes
  • Assuming it queries data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes