0
0
DynamoDBquery~20 mins

Step Functions with DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Step Functions DynamoDB Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output of this DynamoDB query in Step Functions?

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?

A{"Items": [], "Count": 0}
BRuntime error because Status attribute is not indexed
CSyntaxError due to missing FilterExpression
D{"Items": [{"OrderId": {"S": "12345"}, "Status": {"S": "Shipped"}}], "Count": 1}
Attempts:
2 left
💡 Hint

The query uses the partition key to find matching items.

🧠 Conceptual
intermediate
1:30remaining
Which Step Function state type is best to perform a DynamoDB update operation?

You want to update an item in a DynamoDB table as part of a Step Function workflow. Which state type should you use?

APass state to pass data without changes
BTask state with AWS SDK integration calling DynamoDB UpdateItem
CChoice state to decide which item to update
DWait state to delay the update operation
Attempts:
2 left
💡 Hint

Updating data requires an action that interacts with DynamoDB.

📝 Syntax
advanced
2:00remaining
Identify the syntax error in this Step Function DynamoDB query state

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
}
ANo syntax error; the state is valid
BKeyConditionExpression must use #uid instead of :uid
CExpressionAttributeValues keys must be strings without colon prefix
DMissing comma after ExpressionAttributeValues object
Attempts:
2 left
💡 Hint

Check the AWS SDK DynamoDB query syntax for Step Functions.

optimization
advanced
2:30remaining
How to optimize a Step Function that scans a large DynamoDB table?

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?

AUse Query with a partition key filter instead of Scan
BIncrease the ScanLimit parameter to scan more items at once
CAdd a Wait state between scans to reduce throughput
DUse Scan with FilterExpression to reduce returned items
Attempts:
2 left
💡 Hint

Query operations are more efficient than Scan when possible.

🔧 Debug
expert
3:00remaining
Why does this Step Function DynamoDB PutItem state fail with a ValidationException?

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?

ATableName parameter is case-sensitive and should be "products"
BMissing required attribute ProductName in the item
CThe Price attribute value "twenty" is not a valid number format
DResource ARN is incorrect for PutItem operation
Attempts:
2 left
💡 Hint

Check the data types expected by DynamoDB for number attributes.