Skip to content

AWS Step Functions โ€” Serverless Workflows

AWS Step Functions is a serverless workflow orchestration service that lets you coordinate multiple AWS services into resilient multi-step applications using visual state machines.

In Azure terms: Step Functions โ‰ˆ Azure Logic Apps / Azure Durable Functions

Without orchestration, complex workflows in Lambda lead to:

  • Spaghetti code with one Lambda calling another
  • Lost state between steps
  • No visibility into where a workflow failed
  • Difficult retry and error handling logic

Step Functions solves this with a declarative state machine where you define states, transitions, retries, and error handling in JSON (Amazon States Language).

Type Description Execution limit Pricing
Standard Exactly-once execution, full audit history 1 year Per state transition
Express At-least-once, high throughput 5 minutes Per execution + duration

Use Standard for business-critical workflows. Use Express for high-volume event processing (IoT, streaming).

Step Functions workflows are defined in JSON:

{
"Comment": "Order processing workflow",
"StartAt": "ValidateOrder",
"States": {
"ValidateOrder": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123:function:validate-order",
"Next": "ProcessPayment",
"Retry": [{
"ErrorEquals": ["States.TaskFailed"],
"IntervalSeconds": 2,
"MaxAttempts": 3,
"BackoffRate": 2
}],
"Catch": [{
"ErrorEquals": ["InvalidOrderError"],
"Next": "HandleInvalidOrder"
}]
},
"ProcessPayment": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123:function:process-payment",
"Next": "SendConfirmation"
},
"SendConfirmation": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:123:function:send-email",
"End": true
},
"HandleInvalidOrder": {
"Type": "Fail",
"Cause": "Order validation failed"
}
}
}
State Type Description
Task Execute a Lambda, ECS task, SNS publish, DynamoDB call, etc.
Choice Branch based on conditions (like if/else)
Wait Pause for a fixed time or until a timestamp
Parallel Run multiple branches simultaneously
Map Process each item in an array concurrently
Pass Pass input to output (useful for testing or adding data)
Succeed End the execution successfully
Fail End the execution with an error

Step Functions can call AWS services directly without a Lambda wrapper:

  • DynamoDB (GetItem, PutItem, UpdateItem)
  • S3 (GetObject, PutObject)
  • SQS (SendMessage)
  • SNS (Publish)
  • ECS (RunTask)
  • SageMaker (training jobs)
  • Bedrock (LLM invocations)
  • HTTP endpoints (any REST API)
Step 1 โ†’ Step 2 โ†’ Step 3 โ†’ Done
โ”Œโ†’ Step A โ”€โ”
Start โ†’โ”€โ”€โ”€โ”€โ”คโ†’ Step B โ”€โ”œโ”€โ”€โ†’ Merge โ†’ Done
โ””โ†’ Step C โ”€โ”˜
[item1, item2, item3] โ†’ Process all in parallel โ†’ Collect results

Step Functions supports callback patterns where a workflow pauses until a human or external system sends a task token back:

Step Functions sends token to SQS
โ†’ Worker processes and sends approval/rejection back
โ†’ Workflow continues
Feature Step Functions Azure Logic Apps
Visual designer Yes (AWS Console + VS Code) Yes (designer + code view)
Connectors SDK integrations (AWS services) + HTTP 1,000+ connectors (Outlook, SAP, Salesforce)
Code-based workflow Yes (ASL JSON) Yes (workflow JSON)
Error handling Retry + Catch per state Try/Catch blocks
Branching Choice state Condition, Switch actions
Fan-out Map state ForEach loop
Human approval Callback pattern Approval email action
Pricing Per state transition Per action execution
Terminal window
# Create a state machine
aws stepfunctions create-state-machine \
--name order-workflow \
--definition file://workflow.json \
--role-arn arn:aws:iam::123456789:role/step-functions-role \
--type STANDARD
# Start an execution
aws stepfunctions start-execution \
--state-machine-arn arn:aws:states:us-east-1:123456789:stateMachine:order-workflow \
--input '{"orderId": "ord-001", "amount": 99.99}'
# List executions
aws stepfunctions list-executions \
--state-machine-arn arn:aws:states:us-east-1:123456789:stateMachine:order-workflow
# Describe an execution
aws stepfunctions describe-execution \
--execution-arn arn:aws:states:us-east-1:123456789:execution:order-workflow:abc-123