# Step Functions or Lambda durable functions for long-running workflows

> Choose Step Functions when operators need to see each step and redrive the one that failed, and durable functions when the workflow is code your team tests like code. The worked prices show the size of each step's result matters more than the step count.

- Canonical: https://www.alpacamango.com/docs/step-functions-or-lambda-durable-functions
- Author: Zorp
- Published: 2026-11-22 · Updated: 2026-11-21
- Topics: AWS, Event-driven, Architecture, Serverless

**Choose Step Functions when the people who run a workflow need to see every step and restart it from the one that failed. Choose Lambda durable functions when the workflow is really application code that your team wants to unit-test, review and refactor like any other code. For costs, model how much each step writes to the checkpoint log.**

## The same workflow, written two ways

A Step Functions state machine is a graph in Amazon States Language: states, transitions, retries and catches, drawn in the console as you run it. A durable function is an ordinary Lambda handler wrapped by the Durable Execution SDK. Each `step` is checkpointed; a `wait` suspends the function without compute charges; when it resumes, Lambda runs the handler from the top and feeds completed steps their stored results instead of running them again.

```typescript
export const handler = withDurableExecution(async (event, context) => {
  const charge = await context.step(async () => payments.charge(event.orderId));
  await context.wait({ seconds: 3600 });
  await context.step(async () => mailer.sendReceipt(charge.id));
});
```

Both can run for up to a year.

## Who fixes it when it breaks

When a Standard workflow fails, anyone with console access sees the graph with the failed state in red, its input and its error. After fixing the Lambda behind an eligible failed Task, they can redrive within 14 days of execution completion. Step Functions reuses that Task’s original input and preserves the successful preceding states.

Durable functions show checkpoints and step results and can pause and resume an active execution. A terminal failure requires a new execution. For asynchronous runs you can capture failed events in a dead-letter queue. An execution started through a published version or alias stays pinned to that version. Use those qualifiers in production so a deployment cannot change the code that replays saved checkpoints.

## What writing it as code buys

Branches, loops and error handling become the language's own, tested with the framework you already use and reviewed in the same pull request as the business logic. A Step Functions definition can be tested too, but it is a second language with its own expression syntax, and it is easy to end up testing the Lambdas and trusting the graph.

The price is discipline. Because every resume replays from the top, the code outside steps must be deterministic: a timestamp, a random id or an API call made outside a step changes on replay. Step Functions cannot make that mistake. Step Functions can call AWS APIs directly through service integrations, while SDK calls inside a durable function use Lambda compute.

## The cost curves, worked

List prices for US East (N. Virginia) on the Step Functions and Lambda pricing pages, checked 21 November 2026: Standard workflows cost $0.000025 per state transition; durable functions cost $8.00 per million operations (a start, each step, each wait), $0.25 per GB written and $0.15 per GB-month retained, 14 days by default; Express workflows cost $1.00 per million requests plus duration. Take one million executions of ten steps, a 4 KB input and 4 KB returned by each step, with no waits or retries and negligible elapsed time. Leave out free tiers, additional checkpoint overhead and the compute the steps themselves use:

- **Standard:** 12 million transitions, because the start and the end are billed as transitions too: $300.
- **Durable:** 11 million operations ($88), 44 GB written ($11), about 20.5 GB-months retained ($3.08): about $102.
- **Express:** $1 in requests, plus about $3.13 if each run takes three seconds at the smallest 64 MB billing size: about $4.

Raise each step's result to 64 KB and durable climbs to about $294 while Standard stays at $300, because transitions are priced per state and durable storage per byte. Per million steps, Standard costs $25 and durable $8 plus about 32 cents for each KB of result written and kept for 14 days, so in this model the two cross at roughly 53 KB per step on long workflows. Short workflows move the line up, because Standard's start and end transitions weigh more: at ten steps it sits near 66 KB, at three steps near 95 KB. Step count matters in a second way: every Choice and Pass state is a billed transition in Standard, while an `if` in code is free.

Express can be cheaper for short, high-volume work. It stops at five minutes, and an asynchronous Express execution runs at least once, so its tasks must be idempotent; the [idempotent consumers](/docs/idempotent-consumers-sqs-lambda) article covers that half, and the [saga pattern with Step Functions](/docs/saga-pattern-step-functions) shows a Standard workflow doing the job it is best at.

## On Azure and Google Cloud

Azure offers the same split. Durable Functions writes orchestrators as code with replay, in C#, JavaScript, TypeScript, Python, PowerShell or Java, with the Durable Task Scheduler as a managed backend, and Logic Apps is the visual designer. Google Cloud's managed option is Workflows, defined in YAML or JSON and able to run for up to a year, with a visual execution view in the console. [Event-driven architecture on AWS](/docs/event-driven-architecture-on-aws) places both among the other patterns.

## The diagram

One order workflow drawn twice: a Step Functions state machine with redrive from the failed state, and one durable function whose steps checkpoint and replay after a wait. [Open it in archhy](https://archhy.com/d/VeoPFzA92XKx?utm_source=alpacamango) and press Make a copy to adapt it.

Reference documentation: [Step Functions pricing](https://aws.amazon.com/step-functions/pricing/), [Lambda pricing](https://aws.amazon.com/lambda/pricing/), [Step Functions redrive](https://docs.aws.amazon.com/step-functions/latest/dg/redrive-executions.html), [Durable function invocation](https://docs.aws.amazon.com/lambda/latest/dg/durable-invoking.html), [Durable function retries](https://docs.aws.amazon.com/lambda/latest/dg/durable-execution-sdk-retries.html), [Durable Task Scheduler](https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-task-scheduler/durable-task-scheduler), [Google Cloud Workflows](https://docs.cloud.google.com/workflows/docs/overview).
