sfn-golang-example

module
v0.0.0-...-da8b268 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2023 License: Apache-2.0

README

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:

  1. An AWS account with a bucket in the target you can use to store packaged CFN artifacts.
  2. AWS SAM CLI installed.
  3. 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

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

License

This example is released under the Apache License, Version 2.0.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL