How to Test your AWS State Machine Locally on Windows Machine

 To Test State machine Locally we need following tools. On Windows 

1. Docker or Docker Desktop

2. WSL2 - Install if not installed with docker.

3. AWS CLI 

4. AWS SAM 

Steps 

I am assuming we already have lambda function to run it in state machine. 


 Start Your Lambda function using AWS CLI using this command 

sam local start-lambda


It will start your lambda function to your local machine.


Step 2.

Start step function service using following command 

docker run -p 8083:8083 amazon/aws-stepfunctions-local

 


Step 3.

Create State Machine

To create state machine you need to run the following command 

aws stepfunctions create-state-machine --endpoint http://localhost:8083 --definition file://StateMachine.json --name HelloWorldFunction --role-arn "arn:aws:iam::960700000111:role/DummyRole"

This command will create state machine for you

 


Copy the StateMachineArn from above output and run the following command to execute the statemachine.

aws stepfunctions --endpoint http://localhost:8083 start-execution --state-machine arn:aws:states:us-east-1:960700000111:stateMachine:HelloWorldFunction

 


When you will execute the state machine it will give you the executionArn which you can use to get the detail of the execution by using the following command 

aws stepfunctions --endpoint http://localhost:8083 describe-execution --execution-arn arn:aws:states:us-east-1:123456789012:execution:HelloWorldFunction:12ee6ac8-4fb9-4bc5-9f88-dee6c286a8d4

 



all done.

Comments

Popular posts from this blog

How to develop iPhone apps using swift programming step by step

Mobile Applications Development - For Gym Training - iWorkout