sfn-golang-example
This is a basic example of how to use AWS step functions with lambda's written in Go.
overview
The main things to call out features wise are:
deployment
Before you start you need:
- An AWS account with a bucket in the target you can use to store packaged CFN artifacts.
- AWS SAM CLI installed.
- Go version 1.15 or higher installed.
SAM_BUCKET=whatever AWS_REGION=ap-southeast-2 AWS_PROFILE=myprofile make SHELL="sh -x"
Once deployed it will output the ARN of the step function resource which has been created.
You can then run the AWS CLI to start an execution, this one has a good name.
AWS_REGION=ap-southeast-2 AWS_PROFILE=myprofile aws stepfunctions start-execution --state-machine-arn YOUR_ARN_HERE --name $(uuidgen) --input '{"Name":"Mark"}'
This results in an execution which flows without error from Validate Name function, onto Greet Name.
![Good Name Execution](https://github.com/wolfeidau/sfn-golang-example/raw/da8b26890866/docs/images/good_name.png)
You can then run the AWS CLI to start an execution, this one has a bad name, which will trigger an error condition.
AWS_REGION=ap-southeast-2 AWS_PROFILE=myprofile aws stepfunctions start-execution --state-machine-arn YOUR_ARN_HERE --name $(uuidgen) --input '{"Name":"Anton"}'
This results in an execution with an error triggered in the Validate Name function, which is then routed to the Invalid Name function.
![Bad Name Execution](https://github.com/wolfeidau/sfn-golang-example/raw/da8b26890866/docs/images/bad_name.png)
License
This example is released under the Apache License, Version 2.0.