AWS Lambda to AWS Step Functions

AWS Lambda → Step Functions

Invoke an AWS Step Functions workflow from AWS Lambda, with logging enabled

The Serverless Framework template deploys a Lambda function, a Step Functions Express workflow, a Log group and the IAM resources required to run the application. A Lambda function uses the AWS SDK to asyncronously invoke the Express workflow, passing the event body as a string. The Express Workflow results are logged in Amazon CloudWatch Logs.

< 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/lambda-sfn-sls

Deploy

npm installserverless deploy --verbose


Testing

Run the following Lambda CLI invoke command to invoke the function. Note, you must edit the {LambdaProxyArn} placeholder with the ARN of the deployed Lambda function. This is provided in the stack outputs.
aws lambda invoke --function-name {LambdaProxyArn} --invocation-type Event --payload '{ "IsHelloWorldExample": "Hello" }' response.json --cli-binary-format raw-in-base64-out

Cleanup

1. Delete the stack: serverless remove --verbose.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Dmitry Gulin

Dmitry Gulin

Modernization Architect, AWS

Follow on LinkedIn