You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
While SQS, SNS, and EventBridge excel at decoupled, event-driven communication, some workflows require coordination — steps that must happen in a specific sequence, with branching logic, error handling, and retries. AWS Step Functions is a serverless workflow orchestration service that lets you coordinate multiple AWS services into structured, visual workflows.
Event-driven systems use two coordination styles:
Each service reacts to events independently. There is no central coordinator — services communicate through events.
[Order Service] ——event——> [Payment Service] ——event——> [Shipping Service]
Pros: Loose coupling, each service is independent. Cons: Hard to see the full workflow, difficult to handle failures across services.
A central coordinator (Step Functions) manages the workflow. It calls each service in the right order, handles errors, and tracks state.
[Step Functions Orchestrator]
|——> Step 1: Validate Order
|——> Step 2: Process Payment
|——> Step 3: Reserve Inventory
|——> Step 4: Ship Order
|——> Step 5: Send Confirmation
Pros: Clear visibility, centralised error handling, easy to modify workflow. Cons: Central coordinator introduces a dependency.
When to use orchestration: Use Step Functions when the workflow has sequential steps, branching logic, error handling requirements, or when you need visibility into the workflow state.
A Step Functions workflow is called a state machine. It is defined using Amazon States Language (ASL), a JSON-based language that describes the states, transitions, and logic of the workflow.
Each step in the workflow is a state. Step Functions supports several state types:
| State Type | Purpose | Example |
|---|---|---|
| Task | Do work (invoke Lambda, call API, run ECS task) | Process payment |
| Choice | Branch based on a condition | If amount > 100, require approval |
| Wait | Pause for a duration or until a timestamp | Wait 24 hours before sending reminder |
| Parallel | Execute branches simultaneously | Check credit and check inventory at same time |
| Map | Process each item in a collection | Process each line item in an order |
| Pass | Pass input to output (useful for transformations) | Restructure data |
| Succeed | Mark the workflow as successful | End of happy path |
| Fail | Mark the workflow as failed | End with error |
| Feature | Standard | Express |
|---|---|---|
| Max duration | 1 year | 5 minutes |
| Execution guarantee | Exactly-once | At-least-once / at-most-once |
| Pricing | Per state transition ($0.025 per 1,000) | Per execution + duration |
| Throughput | Up to 2,000/s start rate | Over 100,000/s start rate |
| Best for | Order processing, ETL, human approval | IoT data processing, real-time transforms |
Here is a simple order processing workflow:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.