What is AWS Step Function? It’s AWS Step Functions, a serverless orchestration service: you describe a workflow as a state machine, and AWS runs each step in order, retries what fails and records every move.
Your own code, often an AWS Lambda function, does the work inside a step. Step Functions decides what runs next. Here is what starting a workflow looks like from a terminal:
aws stepfunctions start-execution --state-machine-arn arn:aws:states:us-east-1:111122223333:stateMachine:OrderDemo --input '{"orderId": "1002", "total": 950}'That one call hands an order to a state machine called OrderDemo. Step Functions checks the total, parks any order of 500 or more for five seconds, then marks it APPROVED.
You’ll build that exact workflow below in five steps, with nothing but the AWS CLI v2 installed on Mac or Windows and an AWS account. It uses no Lambda at all and costs nothing inside the free tier.
Last checked against the AWS docs on November 23, 2026.
Standard vs Express at a glance. You pick the type when you create the state machine, and it can’t be changed later.
| Key fact | Standard | Express |
|---|---|---|
| Longest run | 1 year | 5 minutes |
| Execution guarantee | Exactly-once | At-least-once (async), at-most-once (sync) |
| Billed by | State transition | Request, duration and memory |
| Run history | Console and API, kept 90 days | CloudWatch Logs only, if logging is on |
| Wait for a job or a callback | Yes (.sync and .waitForTaskToken) | No, Request Response only |
| Redrive and Distributed Map | Yes | No |
| Free tier | 4,000 transitions a month | None |
This post contains affiliate links. As an Amazon Associate, Stepstocloud.com earns from qualifying purchases.
Step Functions turns up in Solutions Architect exam questions about orchestration and decoupling. If that exam is why you’re here, the Sybex AWS Certified Solutions Architect Study Guide works through those service-choice scenarios.

What is AWS Step Function made of?
Three words cover most of it. A workflow in Step Functions is a state machine, each step inside it is a state, and one run from start to finish is an execution.
You write it as JSON or draw it in Workflow Studio, the console’s visual designer, which flips between Design and Code modes.
There are eight state types. Only Task does real work; the other seven steer the flow.
| State | What it does | In the order lab |
|---|---|---|
| Task | Calls an AWS service, an HTTPS API or an activity worker | Not used, so the lab needs no other resources |
| Choice | Picks the next state from rules on the input | CheckOrder |
| Parallel | Runs several branches at the same time | Not used |
| Map | Runs the same steps for each item in a list or dataset | Not used |
| Pass | Passes input to output, optionally reshaping it | ApproveOrder |
| Wait | Pauses for a number of seconds or until a timestamp | HoldForReview |
| Succeed | Ends the execution successfully | Done |
| Fail | Ends the execution with an error name and a cause | RejectOrder |
One old claim still floats around: that state machines can’t loop. They can. A Choice state may point back to an earlier state, and the real ceilings are the history size and the one-year run limit.
What is Amazon States Language?
Amazon States Language (ASL) is the JSON spec behind every state machine: states, transitions, inputs, outputs and error handling. Amazon publishes it as version 1.0, and its most recent addition, in November 2024, was JSONata support.
The console now recommends JSONata for new workflows, though JSONPath stays the default when a definition doesn’t say. The lab below uses JSONata.
What can a Task state call?
Through AWS SDK integrations, a Task can call more than 200 AWS services directly, such as writing an item to Amazon DynamoDB with no Lambda in between.
Optimized integrations add extra handling for popular services like Amazon ECS and AWS Batch.
Since November 2023 the HTTP Task can call any HTTPS API as well. It needs an EventBridge connection to hold the credentials, and each request times out after 60 seconds.
How long a Task waits depends on its integration pattern:
- Request Response (the default): call the service and move on as soon as it answers.
- Run a Job (.sync): wait until a job finishes, such as an AWS Batch job or an AWS Glue run. Standard workflows only.
- Wait for Callback (.waitForTaskToken): hand out a task token and pause, for up to a year, until something calls SendTaskSuccess or SendTaskFailure. Standard only, and the usual way to add a human approval.
How do you build a free AWS Step Functions workflow?
This lab uses only Choice, Wait, Pass, Succeed and Fail states. That means no Lambda, no other resources and an execution role with no permission policies attached.
Each run uses three or four state transitions, so a handful of test runs sits well inside the 4,000 free state transitions you get every month.
The examples use us-east-1 and the placeholder account 111122223333; swap in your own account ID.
Step 1: Create the execution role
Every state machine runs under an IAM role that Step Functions is allowed to assume. If trust policies are new to you, the introduction to AWS IAM explains them. Save this as trust.json:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "states.amazonaws.com" },
"Action": "sts:AssumeRole"
}
]
}Then create the role:
aws iam create-role \
--role-name StepFunctionsDemoRole \
--assume-role-policy-document file://trust.jsonCheck: you’ll get a JSON block back whose Arn ends in role/StepFunctionsDemoRole. You need that ARN in step 2.
Step 2: Create the state machine
Save the definition below as order-demo.asl.json. It is the whole workflow: five states and two rules.
{
"Comment": "Order check demo: Choice, Wait, Pass, Succeed and Fail only, so it needs no other AWS resources",
"QueryLanguage": "JSONata",
"StartAt": "CheckOrder",
"States": {
"CheckOrder": {
"Type": "Choice",
"Choices": [
{
"Condition": "{% $not($exists($states.input.total)) %}",
"Next": "RejectOrder"
},
{
"Condition": "{% $states.input.total >= 500 %}",
"Next": "HoldForReview"
}
],
"Default": "ApproveOrder"
},
"HoldForReview": {
"Type": "Wait",
"Seconds": 5,
"Next": "ApproveOrder"
},
"ApproveOrder": {
"Type": "Pass",
"Output": {
"orderId": "{% $states.input.orderId %}",
"total": "{% $states.input.total %}",
"status": "APPROVED"
},
"Next": "Done"
},
"Done": {
"Type": "Succeed"
},
"RejectOrder": {
"Type": "Fail",
"Error": "MissingTotal",
"Cause": "The order has no total field"
}
}
}Read it top to bottom. The QueryLanguage line switches on the newer syntax, where JSONata expressions inside {% %} replace five JSONPath fields such as InputPath and ResultPath with just Arguments and Output.
CheckOrder sends an order with no total to RejectOrder and holds totals of 500 or more in HoldForReview. Everything else goes straight to ApproveOrder, whose Output builds the result.
ApproveOrder expects an orderId in the input. If a JSONata expression points at a missing field, the state fails with States.QueryEvaluationError, so keep the test inputs below as they are.
Validate the file, then create a Standard state machine:
aws stepfunctions validate-state-machine-definition \
--definition file://order-demo.asl.json
aws stepfunctions create-state-machine \
--name OrderDemo \
--definition file://order-demo.asl.json \
--role-arn arn:aws:iam::111122223333:role/StepFunctionsDemoRole \
--type STANDARD \
--region us-east-1Check: the create call returns a stateMachineArn and a creationDate. If validation complains, look for a missing comma or an unclosed brace before anything else.
Step 3: Start two executions
Send one small order and one big one. A Standard execution name can’t be reused until 90 days after its run closes, so order numbers make handy names.
aws stepfunctions start-execution \
--state-machine-arn arn:aws:states:us-east-1:111122223333:stateMachine:OrderDemo \
--name order-1001 \
--input '{"orderId": "1001", "total": 120}'
aws stepfunctions start-execution \
--state-machine-arn arn:aws:states:us-east-1:111122223333:stateMachine:OrderDemo \
--name order-1002 \
--input '{"orderId": "1002", "total": 950}'Check: each call returns an executionArn and a startDate. On Windows PowerShell, inline JSON quotes tend to break, so save the input as order.json and pass --input file://order.json instead.
Want to watch a failure too? Start a third run named order-1003 with only an orderId and no total. It lands in RejectOrder.
Step 4: Describe the run and list executions
aws stepfunctions describe-execution \
--execution-arn arn:aws:states:us-east-1:111122223333:execution:OrderDemo:order-1001 \
--query '{status: status, output: output}'
aws stepfunctions list-executions \
--state-machine-arn arn:aws:states:us-east-1:111122223333:stateMachine:OrderDemo \
--status-filter SUCCEEDED \
--max-items 10For order-1001 you’ll see something like this:
{"status": "SUCCEEDED", "output": "{\"orderId\":\"1001\",\"total\":120,\"status\":\"APPROVED\"}"}The output is a JSON string inside JSON, which is why the quotes are escaped. Describe order-1002 within its first five seconds and the status reads RUNNING, because it is still sitting in HoldForReview.
Order-1003 shows FAILED, with the error MissingTotal and the cause text from the Fail state. In the console, Step Functions > State machines > OrderDemo lists all three runs; open one to see each state’s input and output.
Step 5: Clean up
aws stepfunctions delete-state-machine \
--state-machine-arn arn:aws:states:us-east-1:111122223333:stateMachine:OrderDemo
aws iam delete-role --role-name StepFunctionsDemoRoleCheck: both commands print nothing when they succeed. Delete the state machine first, since it still references the role.
How does Step Functions handle errors?
Real workflows have Task states, and Tasks fail: a throttled API, a timeout, a bad record. Each Task can carry a Retry list and a Catch list, so error handling sits in the definition instead of in your code.

Here is a fragment (not part of the free lab) for a payment step that calls a Lambda function:
"ChargeCard": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Arguments": {
"FunctionName": "arn:aws:lambda:us-east-1:111122223333:function:charge-card-example",
"Payload": "{% $states.input %}"
},
"Retry": [
{
"ErrorEquals": ["States.TaskFailed"],
"IntervalSeconds": 2,
"MaxAttempts": 3,
"BackoffRate": 2
}
],
"Catch": [
{
"ErrorEquals": ["States.ALL"],
"Next": "RefundAndNotify"
}
],
"Next": "ShipOrder"
}A failed charge is retried three times, waiting 2, 4 and then 8 seconds, because BackoffRate doubles the interval each time. If every attempt fails, Catch sends the run to RefundAndNotify instead of stopping cold.
Watch the bill here: every retry counts as a state transition in a Standard workflow.
Catch paths that undo earlier work follow the saga pattern, first described in a 1987 Princeton paper. If shipping fails, refund the card; if the refund fails, page a person.
Name errors precisely. States.ALL matches anything, States.Timeout fires when a run passes its time limit, and States.QueryEvaluationError means a JSONata expression broke.
What is redrive?
Since November 15, 2023, you can redrive a failed, aborted or timed-out Standard execution within 14 days. It reruns only the failed steps, with the same input and definition, and resets the retry counts.
aws stepfunctions redrive-execution \
--execution-arn arn:aws:states:us-east-1:111122223333:execution:PaymentFlow:order-2001Redriven steps are billed as state transitions. Express workflows can’t be redriven at all.
What are Map and Distributed Map in Step Functions?
A Map state runs the same steps for every item in a list. Inline mode keeps everything inside the parent execution and supports up to 40 concurrent iterations.
Switch to Distributed mode when the dataset is over 256 KiB, when the history would pass 25,000 events, or when you need more than 40 items processed at once.

With MaxConcurrency unset or 0, Distributed Map runs up to 10,000 parallel child executions. Each child is its own Standard or Express workflow, and ResultWriter can write the combined results to Amazon S3.
It reads straight from S3: CSV and JSON files, JSON Lines, other delimited files, Parquet, Athena manifests, or every object under a prefix. JSON Lines and Parquet support arrived in 2025.
Two catches. Distributed mode only runs inside a Standard workflow, and you should set ToleratedFailurePercentage or ToleratedFailureCount if a few bad items shouldn’t fail the whole Map Run.
For scale, AWS’s own pricing example for a Distributed Map over 1 million items comes to $57.15.
How much does AWS Step Functions cost?
Standard workflows cost $0.025 per 1,000 state transitions ($0.000025 each) in US East (N. Virginia). Each state a run moves through is a transition, so a five-step run uses five.
The first 4,000 transitions each month are free for new and existing accounts, and that allowance doesn’t end after 12 months. It is still listed as Always Free after AWS changed its Free Tier in July 2025.
Express workflows have no free tier. You pay $1.00 per million requests plus duration, starting at $0.00001667 per GB-second, with memory billed in 64 MB chunks and time rounded up to the nearest 100 ms.
The Express duration rate drops after the first 1,000 GB-hours in a month, and again after 5,000. These are US East rates; check the AWS pricing page for London, Canada Central or Sydney.
Neither figure covers what the workflow calls. Lambda, DynamoDB and CloudWatch Logs (where Express history lives) bill separately; this breakdown of how much AWS costs covers those.
Step Functions pricing for 1 million runs a month
Take a five-step workflow that runs 1,000,000 times a month, with Express at 64 MB of memory:
| Line item | Standard | Express, 2 s average | Express, 10 s average |
|---|---|---|---|
| Requests | Not charged | $1.00 | $1.00 |
| Usage | 5,000,000 transitions minus 4,000 free = 4,996,000 x $0.000025 = $124.90 | 125,000 GB-seconds x $0.00001667 = $2.08 | 625,000 GB-seconds x $0.00001667 = $10.42 |
| Monthly total | $124.90 | About $3.08 | About $11.42 |
Per run, Standard costs $0.000125. Express costs $0.000001 plus about $0.00000104 for every second it runs, so the two lines cross at roughly 119 seconds.
Put plainly: for a five-step flow, Express stays cheaper until the average run passes about 2 minutes. Bigger payloads, Map or Parallel push memory into more 64 MB chunks and move that line earlier.
Step Functions Standard vs Express: which should you pick?

Price is only one filter. Standard workflows run for up to one year with exactly-once execution. Express runs stop at five minutes and are at-least-once when started asynchronously.
Pick Standard if any step needs more than five minutes, waits on a .sync job or a human callback, must happen exactly once (charging a card), or might need a redrive.
Pick Express for short, high-volume work such as handling events or API requests, and make each step idempotent so a repeated step does no harm.
Synchronous Express runs can be started from API Gateway, Lambda or StartSyncExecution. From the console a synchronous run expires after 60 seconds; use the CLI or an SDK for longer runs.
Step Functions vs Lambda, EventBridge and SQS: which one do you need?
These four get compared because they all sit between the moving parts of an app. A real OrderDemo could use all four: EventBridge to start it, SQS to buffer a slow payment worker, Lambda inside a Task.
| Service | Its job | Tracks workflow state? | Retries | Reach for it when |
|---|---|---|---|---|
| AWS Step Functions | Runs steps in a defined order, with branches and waits | Yes, input, output and history per execution | Built in, per state (Retry and Catch) | The order of steps, waits or approvals matter |
| Lambda on its own | Runs your code for one task | Only what your code stores | Written in your code | One short job with nothing to coordinate |
| Amazon EventBridge | Routes events to targets by rules | No | Retries delivery to targets | Many consumers react to one event, loosely coupled |
| Amazon SQS | Buffers messages between a producer and a consumer | No, a message just waits to be processed | Messages reappear after the visibility timeout | A slow worker must absorb spikes |
The part that matters most in Step Functions vs Lambda: chaining functions by hand puts the order, retries and waiting logic inside your code, where nobody can see it at a glance.
In Step Functions the same logic shows up in the graph, and a Wait or callback state pauses without any of your code running.
AWS now positions Lambda durable functions for code-first workflows inside Lambda, and Step Functions for orchestration across AWS services.
The services also combine. A Task can send an SQS message with a task token and wait until a worker reports back, or EventBridge can start an execution when an event arrives.
Amazon SWF is the older workflow service, and AWS recommends Step Functions for new applications; the guide to Amazon SWF covers where it still fits.
Choosing between these four is a favorite Solutions Architect exam scenario. For practice on exactly that kind of question, Neal Davis’s SAA-C03 practice tests include 390 questions.
What are the AWS Step Functions limits?
A lab like OrderDemo never gets near these quotas, but a few of them shape real designs. These come from the Step Functions quotas page:

| Limit | Value | Notes |
|---|---|---|
| Max run time | 1 year (Standard), 5 minutes (Express) | Longer runs fail with States.Timeout |
| Data per task, state or execution | 256 KiB | Same for both types; CLI –input tops out at 262,144 bytes |
| Execution history | 25,000 events (Standard) | Express has no history limit |
| History retention | 90 days | Can be cut to 30 days on request |
| Redrive window | 14 days | Standard only |
| State machine definition | 1 MB | Hard limit |
| Open executions | 1,000,000 per account per Region | Standard only |
| Distributed Map | 10,000 parallel child executions per Map Run | Hard limit |
| State transitions (Standard) | Bucket 5,000, refill 5,000 per second | us-east-1, us-west-2 and eu-west-1; 800 and 800 elsewhere |
| HTTP Task request | 60 seconds | Hard limit |
The Region matters for that throttle. London (eu-west-2), Canada Central (ca-central-1) and Sydney (ap-southeast-2) get a bucket of 800 refilled at 800 a second, not 5,000. New accounts also start lower, and AWS raises the quota as usage grows.
Four habits keep you clear of the limits that bite:
- Pass S3 keys, not files. Each state can pass at most 256 KiB of data, so put the object in S3 and hand its key along.
- Break long loops. A Standard run that loops past 25,000 events fails; move the loop into Distributed Map or start a fresh execution.
- Count retries and .sync polling when you estimate cost and quota use.
- Turn on CloudWatch Logs for Express. describe-execution and list-executions don’t work for Express runs, so logs are the only record.

AWS Solutions Architect Study Guide (Sybex)
Covers the orchestration and decoupling scenarios where Step Functions, SQS and EventBridge get compared on the SAA-C03 exam.
Check price on Amazon
SAA-C03 Practice Tests (Neal Davis)
390 practice questions for drilling “which service should you use” choices once you know how each one works.
Check price on AmazonFrequently asked questions
What is a step function in AWS used for?
AWS Step Functions coordinates multi-step work across AWS services, such as order processing, data pipelines, invoice extraction, human approvals and batch jobs over large S3 datasets. You define the steps once as a state machine, and Step Functions runs them in order, handles retries and keeps a history of every execution, so that logic stays out of your Lambda code.
Is AWS Step Functions free?
Partly. Standard workflows include 4,000 free state transitions every month for new and existing accounts, and that allowance does not expire after the first year. Beyond it, Standard costs $0.025 per 1,000 transitions in US East (N. Virginia). Express workflows have no free tier: they cost $1.00 per million requests plus a duration charge based on memory.
What is the difference between Step Functions and Lambda?
Lambda runs your code for a single task. Step Functions decides which task runs next, in what order, with what retries and waits, and records each run. Many workflows use both: Step Functions orchestrates and Lambda does the work inside some steps. AWS also offers Lambda durable functions for code-first workflows that stay inside Lambda.
What is the difference between Standard and Express workflows?
Standard workflows run for up to one year with exactly-once execution, keep 90 days of history and are billed per state transition. Express workflows run for up to five minutes, are at-least-once when started asynchronously, log only to CloudWatch Logs and are billed per request and duration. You choose the type at creation and cannot change it later.
What is Amazon States Language?
Amazon States Language (ASL) is the JSON format that defines a Step Functions state machine. It describes each state, such as Task, Choice, Wait, Map or Parallel, which state comes next, and how errors are retried or caught. Since November 2024 it also supports JSONata expressions, which simplify how data moves between states.
How long can an AWS Step Functions workflow run?
A Standard workflow can run for up to one year, which suits human approvals and long batch jobs. An Express workflow stops at five minutes. A run that passes its limit fails with States.Timeout. Long Standard workflows must also stay under 25,000 history events, so very long loops belong in Distributed Map or a fresh execution.
Conclusion
AWS Step Functions takes the “what runs next” logic out of your code and puts it in a state machine you can watch, retry and redrive.
The free OrderDemo lab is the quickest way to see how states, inputs and outputs fit together.
From there, add one Task at a time and keep an eye on transitions and payload size.
- A workflow is a state machine written in Amazon States Language; of the eight state types, only Task does work.
- Standard runs up to 1 year, exactly-once, at $0.025 per 1,000 transitions with 4,000 free each month. Express runs up to 5 minutes at $1 per million requests plus duration.
- For a five-step flow, Express is cheaper until runs average about 2 minutes, and the type can’t be changed after creation.
- Retry and Catch handle errors in the definition; redrive reruns failed Standard runs within 14 days.
- Design around the 256 KiB payload and 25,000-event history limits, and use Distributed Map for big datasets.
Recommended reading
- What Is AWS SNS? A Hands-On Guide to Amazon Simple Notification Service
- AWS Lambda interview questions and answers
- AWS Lambda performance tuning
- What Is AWS? Amazon Web Services Explained for Beginners

I am an Amazon Web Services Professional, having more than 11 years of experience in AWS and other technologies. Extensively working in various AWS tools like S3, Lambda, API, Kinesis, Load Balancers, EKS, ECS, and many more. Working as a Solution Architect and Technology Lead for Architecting and implementing the same for different clients. He provides expert solutions around the world and especially in countries like the United States, Canada, United Kingdom, Australia, New Zealand, etc. Check out the complete profile on About us.