diff --git a/sfn-dynamodb-cdk/README.md b/sfn-dynamodb-cdk/README.md index 5d6f425cf2..8988f35003 100644 --- a/sfn-dynamodb-cdk/README.md +++ b/sfn-dynamodb-cdk/README.md @@ -1,8 +1,7 @@ - # Create an AWS Step Functions workflow 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. -You can find the SAM template for the same pattern [here](https://serverlessland.com/patterns/sfn-dynamodb) +You can find the SAM template for the same pattern [here](https://serverlessland.com/patterns/sfn-dynamodb) Learn more about this pattern at: https://serverlessland.com/patterns/sfn-dynamodb-cdk. @@ -57,7 +56,7 @@ command. Run the following AWS CLI command to send a 'start-execution` command to start the Step Functions workflow. Note, you must edit the {StateMachineArn} placeholder with the ARN of the deployed Step Functions workflow. This is provided in the stack outputs. ```bash -aws stepfunctions start-execution --name "test" --state-machine-arn "{StateMachineArn}" --input "{\"id\": \"12345\" }" +aws stepfunctions start-execution --name "test" --state-machine-arn "{StateMachineArn}" --input "{\"id\": \"12345\" }" ``` ### output: @@ -72,7 +71,7 @@ aws stepfunctions start-execution --name "test" --state-machine-arn "{StateMach Note the `executionArn` from the above output and run the below cli command to get the status of the execution ```bash -aws stepfunctions describe-execution --execution-arn "{executionArn}" +aws stepfunctions describe-execution --execution-arn "{executionArn}" ``` ### Get execution status output: @@ -85,7 +84,7 @@ aws stepfunctions describe-execution --execution-arn "{executionArn}" "status": "SUCCEEDED", "startDate": 1620674586.347, "stopDate": 1620674586.553, - "input": "{\"id\": \"123456\" }", + "input": "{\"id\": \"123456\" }", "inputDetails": { "included": true }, @@ -99,7 +98,7 @@ Once the `status` is `SUCCEEDED`, you can verify what was stored in DynamoDB tab Additionally, you can also verify if the item is stored in DynamoDB by running the below get item cli command on the table. ```bash - aws dynamodb get-item --table-name my-table --key "{\"id\": {\"S\": \"12345\"} }" +aws dynamodb get-item --table-name {tableName} --key "{\"id\": {\"S\": \"12345\"} }" ``` ### DynamoDB Get Item Output: @@ -118,7 +117,7 @@ Additionally, you can also verify if the item is stored in DynamoDB by running t ``` ## Cleanup - + 1. Delete the stack ```bash cdk destroy diff --git a/sfn-dynamodb-cdk/requirements.txt b/sfn-dynamodb-cdk/requirements.txt index 3a672bfa6f..81bf648456 100644 --- a/sfn-dynamodb-cdk/requirements.txt +++ b/sfn-dynamodb-cdk/requirements.txt @@ -1,2 +1,2 @@ -aws-cdk-lib==2.13.0 +aws-cdk-lib==2.260.0 constructs>=10.0.0,<11.0.0 diff --git a/sfn-dynamodb-cdk/sfn_dynamodb_cdk/sfn_dynamodb_cdk_stack.py b/sfn-dynamodb-cdk/sfn_dynamodb_cdk/sfn_dynamodb_cdk_stack.py index e09e1dd3b9..f06bb54550 100644 --- a/sfn-dynamodb-cdk/sfn_dynamodb_cdk/sfn_dynamodb_cdk_stack.py +++ b/sfn-dynamodb-cdk/sfn_dynamodb_cdk/sfn_dynamodb_cdk_stack.py @@ -47,7 +47,7 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: definition = send_to_ddb.next(read_from_ddb) state_machine = sfn.StateMachine( self, "SfnToDDBWorkflowStateMachine", - definition=definition, + definition_body=sfn.DefinitionBody.from_chainable(definition), timeout=Duration.minutes(5) )