Sub topic 10
Choosing Standard or Express workflows
This chapter assumes you can write a basic state machine in Amazon States Language. It also assumes you know the Task, Choice, and Retry features from earlier chapters and understand IAM execution roles. Here you will learn the two workflow types, how they differ, and how to pick one.
Two workflow types
Every state machine has a type, set when you create it. You cannot change the type later. To switch, create a new state machine with the same definition.
- Standard workflows are built for long-running, auditable processes.
- Express workflows are built for short, high-volume, event-processing work.
The ASL you write is the same for both. The differences are in limits, execution guarantees, integration support, and pricing.
Comparing them
| Property | Standard | Express |
|---|---|---|
| Maximum duration | 1 year | 5 minutes |
| Execution semantics | Exactly-once | At-least-once (asynchronous), at-most-once (synchronous) |
| Start rate | Thousands per second, depending on Region | Over 100,000 per second |
| Execution history | Built-in, visible in the console and API, kept 90 days | Only in CloudWatch Logs, if you enable logging |
| `.sync` and `.waitForTaskToken` | Supported | Not supported |
| Pricing | Per state transition | Per execution count, duration, and memory used |
Limits and prices change over time, so check the current Step Functions quotas page before you commit to a design.
Execution semantics
A Standard execution runs each state exactly once unless you add a Retry. Step Functions records progress durably. This makes Standard a good fit for payments, order fulfillment, and anything with side effects that must not be repeated.
An Express execution started asynchronously (StartExecution) runs at least once. Step Functions may run the whole workflow again after an internal failure. A synchronous Express execution (StartSyncExecution) runs at most once, and the caller waits for the result. If it fails, the caller must decide whether to try again.
Because of this, an Express workflow that performs side effects needs idempotent tasks. An idempotent task gives the same result when run twice with the same input. A conditional write in DynamoDB is one example.
Making the choice
Use Standard when:
- the workflow waits for humans or external systems,
- you need exactly-once execution,
- you need a per-execution audit trail,
- volume is moderate.
Use Express when:
- executions finish in seconds,
- you handle streaming data, IoT events, or API backends at high rates,
- your steps are idempotent,
- per-transition pricing on Standard would cost too much.
Many systems combine both. A Standard parent orchestrates a long process and starts Express child workflows for the high-volume, short pieces.
Creating and calling an Express workflow
This command creates an Express state machine. It assumes definition.json holds your ASL and that the role already exists.
aws stepfunctions create-state-machine \
--name QuickValidate \
--type EXPRESS \
--definition file://definition.json \
--role-arn arn:aws:iam::123456789012:role/QuickValidateRoleThen call it synchronously and get the output in the response:
aws stepfunctions start-sync-execution \
--state-machine-arn arn:aws:states:us-east-1:123456789012:stateMachine:QuickValidate \
--input '{"orderId": "1001"}'start-sync-execution works only on Express state machines. A Standard state machine returns an error.
Common mistakes
- Choosing Express for a workflow that includes a human approval step. Express rejects
.waitForTaskTokenand.syncintegrations. - Assuming Express runs only once. Asynchronous runs can repeat, so non-idempotent tasks can duplicate side effects.
- Choosing Standard for millions of tiny executions and receiving a large bill from per-transition pricing.
- Expecting to convert a type in place. The type is fixed at creation.
Exercise
An order workflow charges a credit card, waits up to two days for a manager's approval through a task token, and then ships the order. Which workflow type should you use, and why?
Show answer
Standard. The workflow runs far longer than Express's 5-minute limit, it uses the .waitForTaskToken pattern that Express does not support, and charging a card needs exactly-once execution.
Exercise
A Standard workflow takes 12 state transitions per run and handles 50 million short runs per day. Which workflow type is likely cheaper, and what must you check before switching?
Show answer
Express is likely cheaper, because it is billed by executions, duration, and memory instead of per transition. Before switching, check that every step is idempotent (asynchronous runs are at-least-once), that no state uses .sync or .waitForTaskToken, and that each run finishes within 5 minutes.