Bird
0
0

In a Step Functions Task state configured to call DynamoDB GetItem:

medium📝 query result Q4 of 15
DynamoDB - with Serverless
In a Step Functions Task state configured to call DynamoDB GetItem:
{
  "Type": "Task",
  "Resource": "arn:aws:states:::dynamodb:getItem",
  "Parameters": {
    "TableName": "Products",
    "Key": { "ProductId": { "S": "prod456" } }
  },
  "ResultPath": "$.productInfo"
}

What will be the content of the state output after this task executes successfully?
AThe output will be empty because GetItem does not return any data.
BThe output will only contain the raw DynamoDB response without merging with the input.
CThe output will include the original input plus a 'productInfo' field containing the DynamoDB item attributes.
DThe output will contain only the 'ProductId' key without any attribute values.
Step-by-Step Solution
Solution:
  1. Step 1: Understand ResultPath

    The 'ResultPath' field specifies where to place the result of the Task in the state input. Here, it's set to '$.productInfo'.
  2. Step 2: DynamoDB GetItem Output

    GetItem returns the item attributes if found, which will be inserted under 'productInfo' in the state output.
  3. Final Answer:

    The output will include the original input plus a 'productInfo' field containing the DynamoDB item attributes. -> Option C
  4. Quick Check:

    ResultPath merges result into input [OK]
Quick Trick: ResultPath merges DynamoDB output into input [OK]
Common Mistakes:
MISTAKES
  • Assuming output replaces input entirely
  • Expecting empty output from GetItem
  • Ignoring the effect of ResultPath

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes