Introduction

A number of workflow structures recur across AWS Step Functions projects. These recurring structures are known as design patterns. A design pattern is a reusable solution to a problem that occurs repeatedly. This guide describes the patterns that are most commonly applied and explains when each is appropriate. Readers who are new to the service should first read the guide on what AWS Step Functions is.

What is a design pattern?

In the context of Step Functions, a pattern is a proven arrangement of states that addresses a common coordination need. Rather than each workflow being designed from the beginning, an established pattern is selected and adapted. This makes workflows easier to understand, and it ensures that failure and scale are handled in a known way.

Why patterns are used

The problems that arise when steps are coordinated, such as running work in parallel, making decisions, recovering from failure, and undoing partial progress, occur again and again. Established patterns provide solutions that have already been tested. Their use reduces the risk of errors and shortens the time that is required to build a reliable workflow.

The common patterns

Sequential pipeline

A series of steps is performed in order, and the output of one step becomes the input of the next. This is the simplest pattern and suits a process whose steps have a fixed sequence.

Parallel fan-out

A Parallel state runs a fixed set of branches at the same time and waits for all of them to complete. This suits independent tasks that can be performed together, such as calling several services at once.

Dynamic parallelism with Map

A Map state runs the same steps for every item in a list. The amount of parallel work varies with the size of the input, which suits processing each record in a batch.

Branching with Choice

A Choice state selects the next state based on the data, which allows different paths to be taken according to a condition.

Retry and catch

A state defines retry rules that repeat a failed step, often with an increasing delay known as backoff, and catch rules that direct the workflow to an alternative path when an error is not recovered.

Wait for callback

A workflow pauses at a task and issues a task token, which is a unique identifier. The workflow resumes only when an external system returns that token. This suits human approval or waiting on a long external process.

Saga

The saga pattern coordinates steps that each change data in a separate service, and it defines a compensating action that reverses a completed step if a later step fails. This keeps the system consistent without a distributed transaction.

Pattern diagram

Sequential Fan-out (Parallel) Map (per item) [A] [ A ] [ B ] [ C ] list -> [step] for | \ | / each item in [B] \ | / parallel | (all complete) [C] Choice: pick next state by condition. Retry/Catch: repeat with backoff, then fall back on error. Saga: on failure, run compensating actions to undo prior steps.

Advantages

Disadvantages

Common use cases

Best practices

Common mistakes

Further reading in this library

Frequently Asked Questions

What is a design pattern?
A design pattern is a reusable solution to a problem that occurs repeatedly. In Step Functions, a pattern is a proven way of arranging states to handle a common coordination need.
How is parallel work performed in Step Functions?
A Parallel state runs a fixed set of branches at the same time. A Map state runs the same steps for every item in a list, which allows the amount of parallel work to vary with the input.
What is the wait-for-callback pattern?
A workflow pauses at a task and issues a task token, and it resumes only when an external system returns that token. This suits human approval or waiting on a long external process.
What is the saga pattern?
The saga pattern coordinates steps that each change data in a separate service and defines a compensating action to undo each step if a later step fails, which keeps the system consistent without a distributed transaction.
How are failures handled within a workflow?
Each state can define retry rules that repeat a failed step, often with an increasing delay known as backoff, and catch rules that direct the workflow to an alternative path when an error is not recovered.
Mastering AWS Step Functions cover
Go deeper ยท Book as a Service™
Mastering AWS Step Functions

This article is the summary. The book is the full, continuously updated reference: workflow patterns, callback and saga designs, error handling, and production orchestration.

View the book