Orchestrating Data Pipelines with AWS Step Functions: Patterns and Examples
Quick answer: AWS Step Functions orchestrates data pipelines as serverless state machines with visual workflow design, built-in retry/error handling, and native integrations with Glue, Lambda, ECS, and S3. Use Standard workflows for long-running ETL and Express for high-volume real-time processing. No Airflow server to manage and no scheduler to monitor, although you lose Airflow's scheduling flexibility and open-source ecosystem.
Last updated: October 2026
Why Step Functions for Data Pipelines
Most data teams reach for Airflow or Luigi when they need pipeline orchestration. Step Functions offers a different trade-off: zero infrastructure management in exchange for some flexibility. There's no EC2 instance running a scheduler, no metadata database to back up, no Celery workers to scale. You define your pipeline as a JSON state machine, AWS runs it, and you pay per state transition ($0.025 per 1,000 transitions for Standard workflows).
The visual workflow designer in the AWS console is genuinely useful. You can drag-and-drop states, wire up transitions, and see execution history with per-state timing and input/output payloads. For pipelines with 5-15 steps, this beats staring at a Python DAG file. For a comparison of different ETL approaches on AWS, see our Glue vs Lambda ETL guide.
Standard vs Express Workflows
| Feature | Standard | Express |
|---|---|---|
| Max duration | 1 year | 5 minutes |
| Pricing | $0.025 per 1,000 transitions | Per request, plus duration and memory |
| Job-run (.sync) and callback integrations | Supported | Not supported |
| Execution history | Stored by default (90 days) | Must send to CloudWatch Logs |
| Exactly-once execution | Yes | At-least-once (asynchronous) or at-most-once (synchronous) |
| Best for | ETL jobs, batch processing, multi-step workflows | High-volume event processing, stream transforms |
For data pipelines, you'll almost always use Standard workflows. Your Glue jobs run 5-60 minutes, your ECS tasks might take hours, and you'll want the .sync integration pattern so each state waits for its job to finish, which Express workflows don't support. Express workflows are for scenarios like processing 100,000 S3 events per second, which isn't typical ETL.
Common Data Pipeline Patterns
Pattern 1: Sequential ETL
The simplest pattern: extract, transform, load in sequence. A Glue job extracts raw data to S3, a Lambda cleans and validates it, and a second Glue job loads it into the target warehouse.
Each state uses the .sync integration pattern, which means Step Functions waits for the job to complete before moving to the next state. Without .sync, the state would fire-and-forget, moving to the next state immediately.
Pattern 2: Parallel Fan-Out with Map State
Need to process 20 tables simultaneously? The Map state iterates over an array and runs each item through the same sub-workflow in parallel. Set MaxConcurrency to control how many items run at once. The default of 0 places no limit, but an Inline Map runs at most 40 iterations concurrently, so use Distributed Map when you need more.
This is perfect for ETL pipelines that process multiple source tables: pass an array of table names as input, and the Map state kicks off a Glue job for each table in parallel. Much cleaner than creating 20 parallel branches manually.
Pattern 3: Choice State for Conditional Logic
Different processing based on data characteristics. For example: if the incoming file is CSV, route to a CSV-specific Glue job; if it's Parquet, route to a different job; if it's an unknown format, send an SNS alert and stop.
Pattern 4: Error Handling with Retry and Catch
Every production pipeline needs error handling. Step Functions provides two mechanisms:
- Retry: Automatically retry a failed state with configurable backoff. Set
IntervalSeconds,MaxAttempts, andBackoffRatefor exponential backoff. - Catch: If retries are exhausted, route to a fallback state (e.g., send an SNS notification, log to DynamoDB, or trigger a cleanup Lambda).
Building this out on your own stack? We build data platforms end to end: ingestion, transformation, orchestration, and the alerting that catches a broken load before your users find it. You get running pipelines and the runbook to operate them, not a reference architecture.
Book a platform call Data engineering servicesComplete Pipeline: 3-Stage ETL in ASL
Here's a complete Amazon States Language (ASL) definition for a 3-stage pipeline that extracts data with Glue, transforms with Lambda, and loads with another Glue job. It includes retry logic and error notification. The definition uses JSONPath. Step Functions also supports JSONata expressions and workflow variables (the Assign and Output fields), which make it simpler to pass values such as run_date between states.
{
"Comment": "3-Stage ETL Pipeline: Extract -> Transform -> Load",
"StartAt": "ExtractRawData",
"States": {
"ExtractRawData": {
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName": "extract-raw-to-s3",
"Arguments": {
"--source_database": "production_db",
"--target_s3_path": "s3://data-lake/raw/",
"--run_date.$": "$.run_date"
}
},
"Retry": [
{
"ErrorEquals": ["Glue.AWSGlueException"],
"IntervalSeconds": 60,
"MaxAttempts": 2,
"BackoffRate": 2.0
}
],
"Catch": [
{
"ErrorEquals": ["States.ALL"],
"ResultPath": "$.error",
"Next": "NotifyFailure"
}
],
"ResultPath": "$.extract_result",
"Next": "TransformData"
},
"TransformData": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:transform-validate",
"Parameters": {
"source_path": "s3://data-lake/raw/",
"target_path": "s3://data-lake/cleaned/",
"run_date.$": "$.run_date"
},
"Retry": [
{
"ErrorEquals": ["Lambda.ServiceException"],
"IntervalSeconds": 30,
"MaxAttempts": 3,
"BackoffRate": 2.0
}
],
"Catch": [
{
"ErrorEquals": ["States.ALL"],
"ResultPath": "$.error",
"Next": "NotifyFailure"
}
],
"ResultPath": "$.transform_result",
"Next": "LoadToWarehouse"
},
"LoadToWarehouse": {
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName": "load-cleaned-to-redshift",
"Arguments": {
"--source_s3_path": "s3://data-lake/cleaned/",
"--target_schema": "analytics",
"--run_date.$": "$.run_date"
}
},
"Retry": [
{
"ErrorEquals": ["Glue.AWSGlueException"],
"IntervalSeconds": 60,
"MaxAttempts": 2,
"BackoffRate": 2.0
}
],
"Catch": [
{
"ErrorEquals": ["States.ALL"],
"ResultPath": "$.error",
"Next": "NotifyFailure"
}
],
"ResultPath": "$.load_result",
"Next": "PipelineComplete"
},
"NotifyFailure": {
"Type": "Task",
"Resource": "arn:aws:states:::sns:publish",
"Parameters": {
"TopicArn": "arn:aws:sns:us-east-1:123456789012:pipeline-alerts",
"Message.$": "States.Format('ETL pipeline failed at step. Error: {}', $.error.Cause)",
"Subject": "ETL Pipeline Failure Alert"
},
"Next": "PipelineFailed"
},
"PipelineFailed": {
"Type": "Fail",
"Error": "PipelineExecutionFailed",
"Cause": "One or more pipeline stages failed after retries."
},
"PipelineComplete": {
"Type": "Succeed"
}
}
}
Each task sets ResultPath, so the job's result is added to the state input instead of replacing it. Without it, the Glue job-run result would replace the input, the next state's $.run_date reference would fail to resolve, and the run would stop with a States.Runtime error, which a Catch on States.ALL doesn't handle, so the failure alert would never be sent.
Integrating with AWS Services
Step Functions has native SDK integrations (not just Lambda-based wrappers) for the services data teams use most:
- AWS Glue:
glue:startJobRun.syncstarts a job and waits for completion. Pass arguments dynamically from the state input. - Lambda: Direct invocation. Great for lightweight transforms, validation, and notification logic. Keep functions under the 15-minute Lambda timeout.
- ECS/Fargate:
ecs:runTask.syncruns a container task and waits. Use for heavy processing that needs more than Lambda's 10GB memory limit. - S3:
s3:putObjectands3:getObjectread and write objects directly from Step Functions without a Lambda intermediary. - DynamoDB:
dynamodb:putItemanddynamodb:getItemlog pipeline metadata, check processing status, or store configuration. - SNS/SQS: Publish notifications or queue messages for downstream consumers.
Step Functions vs Airflow
| Aspect | Step Functions | Apache Airflow (MWAA) |
|---|---|---|
| Infrastructure | Fully serverless, zero-ops | Managed (MWAA) but still has environment config |
| Scheduling | EventBridge rules (basic cron) | Built-in scheduler with data-aware triggers |
| Pipeline definition | JSON/YAML (ASL) | Python (full programming language) |
| Error handling | Built-in Retry/Catch per state | Retry at task level, email alerts |
| Monitoring | Visual execution history, CloudWatch | Web UI with Gantt charts, logs |
| Cost (light usage) | $0.025/1K transitions (~free) | ~$300+/month minimum for MWAA |
| Ecosystem | AWS-native only | 1000+ community operators |
| Portability | AWS lock-in | Runs anywhere (GCP Composer, self-hosted) |
The honest answer: for AWS-native pipelines with 5-15 steps, Step Functions is simpler and cheaper. For complex DAGs with 50+ tasks, cross-service dependencies, custom operators, and teams that value Python-first tooling, Airflow is more capable. For S3 bucket permission setup that your Step Functions IAM role needs, check our IAM role creation guide.
Gotchas and Limitations
- One-year execution limit (Standard). A Standard execution can run for up to one year, and its history is kept for 90 days after it closes. ETL rarely comes near the limit, but be aware of it.
- 25,000-event history limit. A Standard execution's history can hold 25,000 events, and each state writes several events, so an Inline Map over a few thousand items can reach the limit well before 25,000 state transitions. Use Distributed Map, which runs iterations as child executions, for large-scale iterations.
- Express workflows can't wait for jobs. They don't support the
.syncjob-run or.waitForTaskTokencallback patterns, so they can't wait for a Glue job or an external approval to finish. Use Standard for those. - Nested parallel states multiply concurrency. A Parallel state inside a Map state runs every branch for every iteration, and an Inline Map runs at most 40 iterations at once. Set explicit
MaxConcurrencyvalues. - No built-in scheduling. You need Amazon EventBridge to trigger workflows on a schedule. It works, but it's one more service to configure compared to Airflow's built-in scheduler.
- Payload size limit: 256KB. Step Functions passes data between states via JSON payloads. If your Lambda returns more than 256KB, store it in S3 and pass the S3 key instead.
Key Takeaways
- Step Functions is the simplest way to orchestrate AWS data pipelines if you don't need Airflow's scheduling power or open-source ecosystem.
- Use Standard workflows for ETL. Express is for sub-5-minute, high-volume event processing.
- Map state replaces manual fan-out. Process N tables in parallel without N parallel branches.
- Retry + Catch = production-grade error handling. Every task state should have both.
- The .sync integration pattern is essential. Without it, Step Functions fires-and-forgets tasks instead of waiting for completion.
- Watch the 25,000-event history limit on large Inline Map iterations. Use Distributed Map for thousands of items.
Frequently Asked Questions
Q: Should I use Standard or Express Step Functions for data pipelines?
Use Standard workflows for long-running ETL jobs (Glue, EMR, ECS) that run minutes to hours. Standard executions can run for up to a year and support the .sync pattern that waits for a job to finish. Express workflows cap at 5 minutes, don't support .sync or callback integrations, and are designed for high-volume event processing, which isn't typical batch ETL.
Q: How does Step Functions compare to Apache Airflow?
Step Functions wins on zero infrastructure management and low cost for small pipelines. Airflow wins on scheduling flexibility (cron, data-aware triggers), Python-first DAG authoring, 1000+ community operators, and cross-cloud portability. For AWS-native pipelines with straightforward dependencies, Step Functions is simpler. For complex DAGs with dozens of tasks and custom logic, Airflow is more powerful.
Q: Can Step Functions run Glue jobs directly?
Yes. Use the glue:startJobRun.sync resource ARN to start a Glue job and wait for completion. Step Functions polls the job status automatically. You can pass dynamic arguments from the state machine input using JSONPath expressions.
Q: What are the main execution limits?
Standard workflows: 1-year maximum duration and 25,000 events in the execution history. Express: 5-minute maximum duration. An Inline Map runs up to 40 iterations concurrently. Payload size between states is limited to 256KB. For large-scale iterations (10,000+ items), use Distributed Map mode instead of inline Map.
Related Articles
Still have questions?
Get AssistanceReady? Let's Talk!
Get expert insights and answers tailored to yourbusiness requirements and transformation.
Get Assistance