# AWS Step Function Tutorial

In this tutorial we will execute the following steps for AWS Step Functions

# a. Create a Step Functions State machine

1. Search for Step Functions in AWS console and select the Step Functions
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722832923265/f8cc1665-83b7-49ef-afba-76a7f7d5e48a.png align="center")

AWS Step Functions is a visual workflow service that helps developers use AWS services to build distributed applications, automate processes, orchestrate microservices, and create data and machine learning (ML) pipelines.

2. Select State Machines from the menu on the left side
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722833361122/f2d52c53-ff41-40bb-b880-31e338f0dd9d.png align="center")

3. Click on the button on the right, button is Create state machine
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722833546125/0d98e8b0-0bb1-40bf-825c-b2ca47776400.png align="center")

4. Select a Blank Template on the next screen, then select Code button on the top to type in the below code and build a simple State Machine.
    
    Providing code here that can be copied:
    
    ```yaml
    {
      "Comment": "A Hello World Example of Amazon States using Pass States",
      "StartAt": "Hello",
      "States": {
        "Hello": {
          "Type": "Pass",
          "Result": "Hello",
          "Next": "World"
        },
        "World": {
          "Type": "Pass",
          "Result": "World",
          "End": true
        }
      }
    }
    ```
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722919449967/eee1745a-cd13-4f0e-9b02-8f32f55608cb.png align="center")

5. Click on the Create button on top right of the screen
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722919996446/6b3226f1-74dd-44fe-a249-88f2650753cf.png align="center")

6. AWS will automatically create roles and permissions required for state machine execution and ask for confirmation:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722920151201/8b078293-5518-4562-a272-8411b903124a.png align="center")

7. AWS will create State Machine and IAM role successfully and show success messages:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722920334509/c812fbf1-5606-4fec-9b7e-976bad4da9b1.png align="center")

# b. Start a new Execution

1. After the state machine is created, click on the button Start Execution:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722920498527/601c55fd-e106-47e6-a4b6-20af56ec9b16.png align="center")

2. In the next pop-up screen, you can enter new name for the execution or keep the name generated by AWS and click on Start execution.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722920705477/5a06efb2-fc52-4fa7-b56f-8ec25d429513.png align="center")

3. As the execution starts AWS will show the message that Execution started successfully
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722920962520/ba52f880-ea58-4b6c-90bc-0a2e3f6f378b.png align="center")

4. In the event view you will see that Execution completed successfully.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722921037932/18f3f57e-80ba-4529-a541-ad2ae6117b5f.png align="center")

# c. Update the Step Function state machine

1. Click on the button for Edit State machine
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723008310988/1b59fb83-ea53-43be-9e33-7416dfabbbcc.png align="center")

2. Click on the button for Code
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723008527651/becd1ffa-d799-4540-8105-3485f1287835.png align="center")

3. Change the code as shown for the World state:
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723008832361/ce19c451-5aae-443f-8b57-190226e67aa5.png align="center")

4. Choose the Save button
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723008928466/e6d72d13-49b5-4e1d-a93c-b022d55785c2.png align="center")

5. Click on the Execute button
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723009334442/c8794640-bff9-4fc9-9aa3-6c464c9664a3.png align="center")

6. In the Graph view select World and see the Output section on right, you will see the updated output.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723009460728/6b7dcd5c-1fb2-4b34-a872-b4b1ef666838.png align="center")

7\. Clean up the resources after the State Machine execution, select the State Machine and click on the Delete button to delete the same.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723009822676/f8c6ca45-554e-46d3-9698-aaa8d55d3325.png align="center")

This completes a simple Step Function and State Machine tutorial.

**About me:** I am an independent technical writer and if you are an organization that want to hire me then I can be contacted at [**techonlinewriter@gmail.com**](mailto:techonlinewriter@gmail.com).
