Consider a DynamoDB table named Orders with a partition key OrderId and an attribute Status. A Step Function executes a Query operation with the following parameters:
{
"TableName": "Orders",
"KeyConditionExpression": "OrderId = :oid",
"ExpressionAttributeValues": {
":oid": {"S": "12345"}
}
}If the table contains one item with OrderId = "12345" and Status = "Shipped", what will the query return?
The query uses the partition key to find matching items.
The query uses the partition key OrderId with value "12345". Since the table has one item with that key, the query returns that item with its attributes.
You want to update an item in a DynamoDB table as part of a Step Function workflow. Which state type should you use?
Updating data requires an action that interacts with DynamoDB.
A Task state can call AWS SDK actions like DynamoDB UpdateItem to modify data. Choice, Pass, and Wait states do not perform data updates.
Given this Step Function state snippet that queries DynamoDB, which option correctly identifies the syntax error?
{
"Type": "Task",
"Resource": "arn:aws:states:::aws-sdk:dynamodb:query",
"Parameters": {
"TableName": "Users",
"KeyConditionExpression": "UserId = :uid",
"ExpressionAttributeValues": {
":uid": {"S": "abc123"}
}
},
"End": true
}Check the AWS SDK DynamoDB query syntax for Step Functions.
The syntax shown is correct for a DynamoDB query in Step Functions. The colon prefix in ExpressionAttributeValues is required and commas are correctly placed.
You have a Step Function that performs a Scan operation on a large DynamoDB table. The scan is slow and expensive. Which approach best optimizes this workflow?
Query operations are more efficient than Scan when possible.
Query uses indexes and partition keys to efficiently retrieve items. Scan reads the entire table and is slower and more costly. Using Query with a partition key filter is the best optimization.
Consider this Step Function state that tries to put an item into DynamoDB:
{
"Type": "Task",
"Resource": "arn:aws:states:::aws-sdk:dynamodb:putItem",
"Parameters": {
"TableName": "Products",
"Item": {
"ProductId": {"S": "p123"},
"Price": {"N": "twenty"}
}
},
"End": true
}It fails with a ValidationException. What is the cause?
Check the data types expected by DynamoDB for number attributes.
DynamoDB expects number attributes to be strings representing numeric values. The string "twenty" is not a valid number format, causing the ValidationException.