Skip to content

AWS Step Functions — Serverless Workflows

AWS Step Functions — Serverless Workflows

Section titled “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).

TypeDescriptionExecution limitPricing
StandardExactly-once execution, full audit history1 yearPer state transition
ExpressAt-least-once, high throughput5 minutesPer 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 TypeDescription
TaskExecute a Lambda, ECS task, SNS publish, DynamoDB call, etc.
ChoiceBranch based on conditions (like if/else)
WaitPause for a fixed time or until a timestamp
ParallelRun multiple branches simultaneously
MapProcess each item in an array concurrently
PassPass input to output (useful for testing or adding data)
SucceedEnd the execution successfully
FailEnd 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
FeatureStep FunctionsAzure Logic Apps
Visual designerYes (AWS Console + VS Code)Yes (designer + code view)
ConnectorsSDK integrations (AWS services) + HTTP1,000+ connectors (Outlook, SAP, Salesforce)
Code-based workflowYes (ASL JSON)Yes (workflow JSON)
Error handlingRetry + Catch per stateTry/Catch blocks
BranchingChoice stateCondition, Switch actions
Fan-outMap stateForEach loop
Human approvalCallback patternApproval email action
PricingPer state transitionPer 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