1.State Machines, Tasks, and Executions
A Step Functions workflow is called a state machine — a series of steps called states, defined in JSON (Amazon States Language). A Task state runs one unit of work, usually a Lambda function or another AWS service call. Each time you start the state machine, that run is called an execution, and Step Functions records every state transition as execution history you can inspect afterward.
Key features
- A state machine is defined in the Amazon States Language (ASL), a JSON-based structure of named states
- A Task state is a single unit of work — commonly an AWS Lambda invocation, or a direct call to another AWS service via a service integration
- Every state (except Succeed/Fail) needs a Next field pointing to the following state, or End: true to terminate the workflow there
- An execution is one run of the state machine, started by the console, the StartExecution API, or an EventBridge rule, and produces JSON output from JSON input
- Standard Workflows keep full execution history — every state entered, its input/output, and timing — retrievable via the API for 90 days after completion
- Standard Workflows run exactly-once per state (unless Retry is configured) and can run for up to one year; Express Workflows run at-least-once and cap at five minutes
- StartExecution
- leads to ValidateOrder (Task) (StartAt)
- ValidateOrder (Task)
- leads to ChargeCard (Task) (Next)
- ChargeCard (Task)
- leads to Execution result (End: true)
- Execution result
Command
{
"StartAt": "ValidateOrder",
"States": {
"ValidateOrder": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:ValidateOrder",
"Next": "ChargeCard"
},
"ChargeCard": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:ChargeCard",
"End": true
}
}
}A state machine is a JSON workflow of named states; a Task state does one unit of work (usually a Lambda call). Each run is an execution, and Step Functions records every state transition as execution history you can inspect without adding your own logging.