State Machines, Tasks, and Executions
standardintermediateA 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.
Think of it as
Think of a state machine as a flowchart you hand to AWS instead of writing as if/else code. Each box is a state; a Task state is a box that does real work by calling a service. Every time the flowchart runs, that is one execution, and Step Functions keeps a step-by-step log of exactly which boxes ran, in what order, with what input and output — so a failure shows you precisely where it stopped rather than a stack trace you have to reconstruct yourself.
What we're doing: See how a two-step order workflow reads as a state machine definition, and what its execution history shows after a run.
- 2
- StartAt names the first state Step Functions enters when an execution begins.
- 6
- Next chains ValidateOrder to ChargeCard — after ValidateOrder's Lambda returns, this is the state that runs next.
- 12
- End: true marks ChargeCard as the workflow's terminal state; there is no further Next.
Why this works: Every state transition here — entering ValidateOrder, its Lambda's input/output, entering ChargeCard, the execution's final result — is recorded as execution history, so a failed order can be traced to the exact state and payload that caused it, without adding any logging code yourself.
- StartExecution
- leads to ValidateOrder (Task) (StartAt)
- ValidateOrder (Task)
- leads to ChargeCard (Task) (Next)
- ChargeCard (Task)
- leads to Execution result (End: true)
- Execution result
Remember: 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.
See also: error handling and advanced state types · step functions vs orchestration in lambda

