Menu
AWS Step Functions
Developer Guide

Getting Started

This tutorial introduces you to the basics of working with AWS Step Functions. You'll create a simple, independently running state machine using a Pass state. The Pass state represents a no-op (an instruction with no operation).

Step 1: Creating a State Machine

Step Functions offers various predefined state machines as templates. Create your first state machine using the Hello World blueprint.

To create the state machine

  1. Sign in to the Step Functions console, and then choose Get Started.

  2. On the Create a state machine page, select Templates and choose Hello world.

    
              Hello world.

    Step Functions fills in the name of the state machine automatically. It also populates the Code pane with the Amazon States Language description of the state machine.

    { "Comment": "A Hello World example of the Amazon States Language using a Pass state", "StartAt": "HelloWorld", "States": { "HelloWorld": { "Type": "Pass", "Result": "Hello World!", "End": true } } }

    This JSON text defines a Pass state named HelloWorld. For more information, see State Machine Structure.

  3. Use the graph in the Visual Workflow pane to check that your Amazon States Language code describes your state machine correctly.

    
              Visual Workflow.

    If you don't see the graph, choose 
       refresh
    in the Visual Workflow pane.

  4. If you have previously created an IAM role for Step Functions, that role will be listed. If not, follow the AWS IAM link and see Creating IAM Roles for AWS Step Functions. After you create the role, choose the 
       refresh
    button next to the IAM role for your state machine executions entry.

    Note

    For more information about creating an IAM role manually, see Creating IAM Roles for AWS Step Functions.

    If you delete the IAM role that Step Functions creates, Step Functions can't recreate it later. Similarly, if you modify the role (for example, by removing Step Functions from the principals in the IAM policy), Step Functions can't restore its original settings later.

  5. Choose Create State Machine.

Step 2: Starting a New Execution

After you create your state machine, you can start an execution.

To start a new execution

  1. On the Helloworld page, choose New execution.

    The New execution window is displayed.

  2. (Optional) To help identify your execution, you can specify an ID for it in the Enter your execution id here box. If you don't enter an ID, Step Functions generates a unique ID automatically.

    Note

    Step Functions allows you to create state machine, execution, and activity names that contain non-ASCII characters. These non-ASCII names do not work with CloudWatch. To ensure that you can track CloudWatch metrics, choose a name that uses only ASCII characters.

  3. Choose Start Execution.

    A new execution of your state machine starts, and a new page showing your running execution is displayed.

  4. (Optional) In the Execution Details section, choose the Info tab to view the Execution Status and the Started and Closed timestamps.

  5. To view the results of your execution, choose the Output tab.

    
              State machine results.

Step 3: (Optional) Update a State Machine

You can update your state machine for future executions.

Note

State machine updates in Step Functions are eventually consistent. All executions within a few seconds will use the updated definition and roleArn. Executions started immediately after updating a state machine may use the previous state machine definition and roleArn.

To update a state machine

  1. On the Helloworld page, choose Edit state machine.

    The Edit page is displayed.

  2. In the Code pane, edit the Amazon States Language description of the state machine. Update the Result to read Hello World has been updated!

    { "Comment": "A Hello World example of the Amazon States Language using a Pass state", "StartAt": "HelloWorld", "States": { "HelloWorld": { "Type": "Pass", "Result": "Hello World has been updated!", "End": true } } }
  3. (Optional) Select a new IAM role from the IAM role for executions list.

    Note

    You can also select Create new role to create a new IAM role. For more information, see Creating IAM Roles for AWS Step Functions.

  4. Choose Update and start execution.

    The New execution window displays a message that the state machine was successfully updated.

  5. Choose Start Execution.

  6. To view the results of your execution, choose the Output tab in the Execution Details section.

    
              Start new execution.

    Note

    The output text matches your newly updated state machine.

Next Steps

Now that you've created a simple state machine using a Pass state, try the following: