serverlessawsstep-functionscost-optimization

Workflow orchestration cost: state machines versus code

Orchestrating a multi-step process can be a managed state machine, a chain of queues, or a single long-running function. Each has a different cost curve. Here is where each one wins.

The C3X Team··7 min read

Quick answer

Standard Step Functions cost $0.025 per 1,000 state transitions, which is $25 per million. A 10-step workflow run 1 million times a month costs about $250 in transitions alone, before the Lambda functions it calls. Express workflows cost $1.00 per million requests plus $0.00001667 per GB-second of duration, roughly 20 to 50 times cheaper for short, high-volume flows. Orchestrating in code inside a single Lambda costs nothing extra but gives up retries, visibility, and durable state. The rule: Standard for low-volume long-running flows, Express for high-volume short flows, and plain code when the workflow has fewer than three steps.

Every multi-step process needs a coordinator. You can buy one as a managed state machine, build one from queues and functions, or just write the steps in sequence inside a single function. The engineering trade-offs are well covered. The cost trade-offs are less so, and they differ by more than an order of magnitude depending on volume and step count.

The price lists

ApproachUnit costScales with
Step Functions Standard$0.025 per 1,000 transitionsSteps times executions
Step Functions Express$1.00 per million requests + $0.00001667 per GB-sExecutions and duration
SQS chain$0.40 per million requestsMessages per hop
EventBridge chain$1.00 per million custom eventsEvents per hop
In-code orchestration$0Nothing extra

The critical detail with Standard workflows is that you pay per state transition, not per execution. Every task, choice, wait, map iteration, and parallel branch counts. A workflow that looks like five business steps often has twelve transitions once you count choice states, error catchers, and the pass states people add for readability.

A concrete comparison

Take an order-processing flow with 10 transitions, run 1 million times a month, where each of 4 Lambda tasks runs 200 ms at 512 MB.

ComponentStandardExpressSQS chain
Orchestration$250.00$1.00$1.60
Orchestration durationn/a$4.17n/a
Lambda duration (4 x 200 ms, 512 MB)$6.67$6.67$6.67
Lambda requests$0.80$0.80$0.80
Monthly total$257.47$12.64$9.07

The orchestration layer costs 38 times the compute it coordinates in the Standard case. That is the single most common surprise in a serverless bill: the glue outspends the logic. Express assumes a 1 second workflow at the minimum 64 MB billing tier for the duration figure, which is realistic for a fast flow.

When Standard is still the right answer

Standard is not overpriced, it is priced for a different job. It supports executions up to one year, exactly- once execution semantics, full execution history retained for 90 days, and human-approval callbacks. Express caps at 5 minutes, offers at-least-once semantics, and sends history to CloudWatch Logs where you pay $0.50 per GB ingested for it.

For a nightly ETL that runs 30 times a month with 200 transitions, Standard costs 30 times 200 times $0.000025 equals $0.15. For a deployment pipeline, a document approval, or a multi-day onboarding flow, the transition charge is rounding error and the durability is worth everything. The cost problem only appears when a high-frequency, per-request workflow is built on Standard because that is what the team knew.

Reducing transitions without changing the design

If you must stay on Standard, cut transitions. Collapse consecutive Pass states, which exist only for readability and cost the same as real work. Replace Choice-then-Pass patterns with a single Choice that routes directly. Use Map state concurrency carefully: a Map over 100 items generates at least 100 iterations of transitions, so a 3-state inner workflow over 100 items is 300-plus transitions per execution, which at 1 million executions is $7,500 a month. Do the batching inside one task instead when the items are small.

PatternTransitions per executionCost per 1M executions
4 tasks, no branching6$150
4 tasks, 3 choices, 2 passes12$300
Map over 50 items, 2 inner states105$2,625
Same map batched inside one task6$150

Direct service integrations

Both workflow types can call many AWS services directly rather than through a Lambda function. A state that writes to DynamoDB, publishes to SNS, or starts a Glue job without an intervening function removes an invocation charge, a duration charge, a cold start, and a piece of code to maintain. On a workflow running 1 million times a month, replacing three trivial glue functions at 128 MB and 100 ms each with direct integrations saves about $0.60 in requests and $0.63 in duration, which is small, but it also removes three deployment artifacts and three sources of failure. The state transition still costs $0.025 per thousand, so this reduces compute rather than orchestration, and it is most valuable where the function did nothing but forward a payload.

The in-code option

For two or three steps with no long waits and no need for durable intermediate state, calling the steps sequentially in one function is cheaper and simpler. You pay only Lambda duration, and duration for sequential I/O-bound calls is usually short. The cost you accept is that a failure halfway through has no automatic resume, so you need idempotent steps and your own retry logic. Once the flow has branching, long waits, or steps that must survive a crash, the orchestrator earns its price. Compare the options against the state machine pricing detail and price the whole flow against the resource catalog before you pick an approach.

FAQ

How much do Step Functions cost per workflow?

Standard workflows cost $0.025 per 1,000 state transitions, so a 10-transition workflow costs $0.00025 per execution, or $250 per million executions. Express workflows cost $1.00 per million requests plus $0.00001667 per GB-second of duration, which for a 1 second workflow at the 64 MB minimum tier is roughly $5 per million executions all in.

Why is my Step Functions bill higher than my Lambda bill?

Because Standard workflows bill per state transition, not per execution, and every task, choice, wait, pass, and map iteration counts. A workflow calling four 200 ms Lambda functions costs about $7 per million in compute but $250 per million in transitions if it has 10 states. The orchestration layer commonly outspends the logic it coordinates.

When should I use Express instead of Standard workflows?

Use Express for high-volume, short-lived flows under 5 minutes where at-least-once semantics are acceptable, since it is typically 20 to 50 times cheaper at scale. Use Standard for long-running flows up to a year, exactly-once semantics, human-approval callbacks, and cases where the built-in 90 day execution history is worth the per-transition price.

How do I reduce Step Functions transition costs?

Collapse consecutive Pass states that exist only for readability, replace Choice-then-Pass routing with a single Choice, and be careful with Map states, since a Map over 50 items with a 2-state inner workflow costs over 100 transitions per execution. Batching small items inside one task instead of mapping over them can cut a $2,625 per million bill to $150.

Is it cheaper to orchestrate in code inside one Lambda?

For two or three sequential steps with no long waits and no need for durable intermediate state, yes. You pay only Lambda duration and no orchestration fee at all. The trade-off is that a failure partway through has no automatic resume, so you need idempotent steps and your own retry logic, and you lose per-step execution visibility.

How does C3X help with orchestration cost?

C3X prices workflow and messaging resources from Terraform, so the cost of a state machine, its queues, and the functions it invokes appears together in the pull request. That makes it visible when a per-request workflow built on Standard will cost hundreds of dollars a month in transitions, while the alternative design is still a code change rather than a migration.

What to do next

Price the glue, not just the logic. C3X reads your Terraform and prices your resources against a live catalog. Start with the quickstart.

Try C3X on your own Terraform

Free and open source. No API key required. One command to install, one command to estimate.