Step Functions Local

Before we wrap up, it's worth mentioning an alternative method for developing Step Functions workflows that isn't directly in AWS. It's possible to download a local version of Step Functions so that you can write code on your own machine. This artifact comes as a .jar file or a Docker image. All you have to do to start a container is pull the image from Docker Hub. Let's get started:

  1. Use the following command to download the image from Docker Hub. It is assumed you have Docker installed:
docker pull amazon/aws-stepfunctions-local
  1. Run it, publish the port mapping, and you'll be away:
docker run -p 8083:8083 amazon/aws-stepfunctions-local

There are actually a few environment variables you have to set inside the running container. Check out the links in the Further reading section, where you will get an idea as to where you can find the details on this. 

To interact with the locally running service, you will also need to have the AWS SAM CLI Local installed and running. This is because the SAM CLI provides a local version of the Lambda service so that you can test your code while writing. 

Once all the services are running, use the --endpoint option in the AWS CLI to reference your deployment endpoint, like so:

aws stepfunctions --endpoint http://localhost:8083 create-state-machine

That's it! Work on your state machine definitions locally and then deploy these to AWS. This is a good development method if you have an intermittent communication with AWS for some reason, and it shouldn't replace a non-production type of environment.

In this section, we learned that it is possible to run some AWS services locally for development purposes. This is an easy way to get started writing your own state machines. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.88.110