AWS Lambda to AWS Step Functions

AWS Lambda → Step Functions

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

The SAM 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. The Lambda function returns the Express Workflow execution ARN and startDate.

< 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-rust

Deploy

sam deploy --guided


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: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Daniele Frasca

Daniele Frasca

I am Daniele Frasca serverless enthusiast. I build and architect serverless applications at scale.