Menu
AWS Step Functions
Developer Guide

States

States are elements in your state machine. A state is referred to by its name, which can be any string, but which must be unique within the scope of the entire state machine.

Note

An instance of a state exists until the end of its execution.

States can perform a variety of functions in your state machine:

  • Do some work in your state machine (a Task state).

  • Make a choice between branches of execution (a Choice state)

  • Stop an execution with a failure or success (a Fail or Succeed state)

  • Simply pass its input to its output or inject some fixed data (a Pass state)

  • Provide a delay for a certain amount of time or until a specified time/date (a Wait state)

  • Begin parallel branches of execution (a Parallel state)

For example, here is a example state named HelloWorld which performs a Lambda function:

"HelloWorld": {
  "Type": "Task",
  "Resource": "arn:aws:lambda:us-east-1:123456789012:function:HelloFunction",
  "Next": "AfterHelloWorldState",
  "Comment": "Run the HelloWorld Lambda function"
}

States share a number of common features:

  • Each state must have a Type field indicating what type of state it is.

  • Each state can have an optional Comment field to hold a human-readable comment about, or description of, the state.

  • Each state (except a Succeed or Fail state) requires a Next field or, alternatively, can become a terminal state by specifying an End field.

    Note

    A Choice state may have more than one Next but only one within each Choice Rule. A Choice state cannot use End.

Certain state types require additional fields, or may redefine common field usage.

For more information regarding the various states that you can define using Amazon States Language, see States.

Once you create a state machine and executed it, you can access information about each state, its input and output, when it was active and for how long, by viewing the Execution Details page in the Step Functions console.