Transitions
When you start a new execution of your state machine, the system begins with the state
referenced in the top-level StartAt
field. This field, given as a string, must
exactly match, including case, the name of a state in the workflow.
After a state runs, Amazon Step Functions uses the value of the Next
field to determine
the next state to advance to.
Next
fields also specify state names as strings. This string is case-sensitive
and must match the name of a state specified in the state machine description exactly
For example, the following state includes a transition to NextState
.
"SomeState" : {
...,
"Next" : "NextState"
}
Most states permit only a single transition rule with the Next
field. However,
certain flow-control states, such as a Choice
state, allow you to specify
multiple transition rules, each with its own Next
field. The Amazon States Language provides details
about each of the state types you can specify, including information about how to specify
transitions.
States can have multiple incoming transitions from other states.
The process repeats until it either reaches a terminal state (a state with "Type":
Succeed
, "Type": Fail
, or "End": true
), or a runtime
error occurs.
The following rules apply to states within a state machine:
-
States can occur in any order within the enclosing block. However, the order in which they're listed doesn't affect the order in which they're run. That order is determined by the contents of the states.
-
Within a state machine, there can be only one state designated as the
start
state. Thestart
state is defined by the value of theStartAt
field in the top-level structure. -
Depending on your state machine logic — for example, if your state machine has multiple logic branches — you may have more than one
end
state. -
If your state machine consists of only one state, it can be both the start and end state.