This is a simple Node.js AWS Lambda seed that invokes an AWS Step Function. It uses node-lambda for locally running and deploying.
AWS Step Functions are a great way to maintain state and orchestrate AWS Lambda functions. However, currently, invoking a Step Function is limited to, e.g., API Gateway, Cloudwatch, etc. The purpose of this repo is to serve as a means to invoke a Step Function from a Lambda function. This way, if you want to, for example, invoke a Step Function from SES, this function can serve as the conduit.
npm i -g aws-sdkto install AWS SDK if you haven't already.npm iin repo directory to build node modules.- Configure aws-sdk in your home directory. Ensure the Lambda-controlling
aws_access_key_idandaws_secret_access_keyare in, e.g.,~/.aws. This way you don't have to keep this in.envwhich I prefer to keep in version control. - Create an AWS Lambda function on AWS. Edit
.envandpackage.jsonwith your Lambda function name. - Create an AWS IAM Role with a Lambda trusted relationship. Give it
permissions for Step Functions. Edit
.envto add the role. - Create a Hello World Step Function. Edit
index.jswith the ARN of this Step Function. npm run startto run it locally! It works, right? Great!npm run deployto push into the cloud...- Test that everything works by executing the Lambda function from AWS Console.