AWS Step Functions to Amazon DynamoDB

Step Functions → Amazon DynamoDB

Create an AWS Step Functionsworkflow to integrate with Amazon DynamoDB

The CDK application deploys a Step Functions workflow, that takes in a payload and puts the item in DynamoBb. Additionally, this workflow also shows how to read an item directly from the DynamoDB table. The CDK application contains the minimum IAM resources required to run the application.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/sfn-dynamodb-cdk

Deploy

cdk deploy


Testing

Run the following AWS CLI command to send a 'start-execution` command to start the Step Functions workflow. Note, you must edit the {StateMachineExpressSynctoLambda} placeholder with the ARN of the deployed Step Functions workflow: aws stepfunctions start-execution --name "test" --state-machine-arn "{StateMachinetoDDBArn}" --input "{\"id\": \"12345\" }"

Cleanup

1. Delete the stack: npx cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus".
3. You see a message confirming DELETE_COMPLETE.

Created by:

Revanth Anireddy

Revanth Anireddy

Senior Cloud Applications Architect @ AWS.