0
0
DynamoDBquery~30 mins

Step Functions with DynamoDB - Mini Project: Build & Apply

Choose your learning style9 modes available
Step Functions with DynamoDB
📖 Scenario: You are building a simple order tracking system for a small online store. The system uses AWS Step Functions to manage the order process and DynamoDB to store order data.Each order has an OrderId, CustomerName, Status, and TotalAmount.
🎯 Goal: Create a DynamoDB table called Orders with the specified attributes. Then, configure a Step Function state to insert a new order into the Orders table. Finally, update the order status using Step Functions.
📋 What You'll Learn
Create a DynamoDB table named Orders with OrderId as the primary key.
Add an initial order item with OrderId '1001', CustomerName 'Alice', Status 'Pending', and TotalAmount 250.
Create a Step Function task state to insert the order into the Orders table.
Create a Step Function task state to update the Status of the order to 'Shipped'.
💡 Why This Matters
🌍 Real World
Managing order workflows in e-commerce platforms using AWS Step Functions and DynamoDB for reliable state management and data storage.
💼 Career
Understanding how to integrate AWS Step Functions with DynamoDB is valuable for cloud engineers and developers working on serverless applications and workflow automation.
Progress0 / 4 steps
1
Create the DynamoDB table and initial order item
Write the AWS CLI command to create a DynamoDB table named Orders with OrderId as the partition key of type string. Then, write the AWS CLI command to put an item into the Orders table with OrderId '1001', CustomerName 'Alice', Status 'Pending', and TotalAmount 250.
DynamoDB
Need a hint?

Use aws dynamodb create-table with --attribute-definitions and --key-schema. Use aws dynamodb put-item with the JSON item.

2
Define the Step Function task to insert an order
Write a JSON snippet defining a Step Function task state named InsertOrder that uses the arn:aws:states:::dynamodb:putItem resource to insert an order into the Orders table. The task should use OrderId, CustomerName, Status, and TotalAmount from the input. Use TableName as Orders.
DynamoDB
Need a hint?

Use "Resource": "arn:aws:states:::dynamodb:putItem" and "Parameters" with TableName and Item. Use .$ to reference input fields.

3
Define the Step Function task to update order status
Write a JSON snippet defining a Step Function task state named UpdateOrderStatus that uses the arn:aws:states:::dynamodb:updateItem resource to update the Status attribute of an order in the Orders table. Use OrderId from the input as the key. Set the Status attribute to 'Shipped'.
DynamoDB
Need a hint?

Use arn:aws:states:::dynamodb:updateItem with UpdateExpression to set Status. Use ExpressionAttributeNames and ExpressionAttributeValues to specify the new status.

4
Complete the Step Function definition with both tasks
Combine the InsertOrder and UpdateOrderStatus task states into a Step Function state machine JSON. The state machine should start with InsertOrder and then transition to UpdateOrderStatus. Mark UpdateOrderStatus as the end state.
DynamoDB
Need a hint?

Use "StartAt" to set the first state. Use "Next" in InsertOrder to go to UpdateOrderStatus. Mark UpdateOrderStatus with "End": true.