Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

AWS Lambda durable functions are a better fit than ordinary Lambda handlers when a workflow must span long waits or recover across interruptions without losing completed work. They let developers write multi-step logic in familiar programming languages while Lambda checkpoints progress and resumes the workflow. Choose Step Functions instead when visual orchestration, independence from Lambda, or broad native integrations matter more than keeping workflow logic in code.

What are AWS Lambda durable functions?

A durable function is a Lambda handler that uses a DurableContext to run checkpointed steps and perform operations such as waiting or pausing for a callback. AWS records completed work as checkpoints so the workflow can continue after an interruption.

How checkpointing and replay work

  1. Initialize: The handler starts and sets up its durable context.
  2. Run checkpointed operations: The handler performs work in durable steps. Completed operations and their results are recorded.
  3. Wait when needed: A wait or callback operation can suspend the workflow instead of keeping an invocation actively running.
  4. Resume after an interruption: When the workflow continues, the handler is replayed from the beginning. Completed durable operations are skipped using their stored results, and execution proceeds from the last checkpoint.
  5. Finish: After the workflow completes, its execution shuts down.

Replay changes how to think about side effects. Code outside a durable operation may run again when the handler is replayed. Structure consequential work—such as making a payment or creating a record—so it is covered by the workflow’s durable operations and does not accidentally happen twice.

What benefits do durable functions offer?

Recovery without rebuilding a state machine

Checkpoints, retries, and automatic recovery help a multi-step workflow make progress through transient failures without requiring developers to build all the state tracking and retry machinery themselves. This is useful when an interruption should not force the application to repeat already completed work.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Workflows that outlast a normal Lambda invocation

A standard Lambda function can run for up to 15 minutes; a durable function can run for up to one year while preserving progress, according to AWS Lambda documentation. That makes the durable model suitable for processes whose next action depends on an event or decision that may arrive much later.

  • Employee or loan approvals that wait for a person to respond
  • Payment and fulfillment coordination across multiple stages
  • Polling an external system for a result
  • Human-in-the-loop AI workflows that pause for review or input

Familiar code for Lambda-centric application logic

The durable-functions SDK is available for JavaScript, TypeScript, Python, and Java. Teams can express a workflow using ordinary language control flow and their usual testing tools, while the SDK manages checkpoint and replay mechanics.

Managed execution without a workflow server

Durable functions run in the managed Lambda environment, which scales automatically, including scaling to zero. This avoids operating separate workflow servers, but keeps the design tied to Lambda and its event-driven model.

Do durable functions save money while a workflow waits?

A durable wait suspends execution without compute charges for the waiting period, according to AWS. That can avoid paying for an actively running Lambda invocation merely to wait for an approval, callback, timer, or polling interval.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This does not make the whole workflow free: active execution and other AWS services it uses can still incur charges. There is no universal cost saving to quote without knowing the workflow’s duration, activity, and service usage, so compare the expected usage for the particular design rather than treating the wait behavior as a total-cost estimate.

Durable functions versus Step Functions

Both approaches orchestrate multi-step work, but they put the workflow in different places. Durable functions keep application-level orchestration in Lambda code; Step Functions provides a standalone workflow service with visual orchestration and a wider set of native integrations.

Decision factor Lambda durable functions Step Functions
Execution location Inside a Lambda handler, using a durable context. In the Step Functions orchestration service, separate from the individual compute tasks.
Programming model Sequential control flow in supported SDK languages: JavaScript, TypeScript, Python, and Java. A separately defined state-machine workflow; useful when orchestration should not live in Lambda application code.
Workflow visibility Logic is expressed and maintained in code. Visual workflow orchestration is a central advantage.
Integration breadth Fits logic centered on Lambda and its application code. AWS describes Step Functions as integrating with more than 220 AWS services and more than 16,000 APIs in its durable-functions/Step Functions comparison material.
Infrastructure management Managed in Lambda, with automatic scaling; no separate workflow server to operate. Managed orchestration service, not a workflow server that the team must host.
Coupling to Lambda High: the orchestration is part of the Lambda handler and its event-driven runtime. Lower: orchestration is independent of a single Lambda handler and can coordinate cross-service workflows.

Choose durable functions when

  • The business workflow is primarily Lambda application logic.
  • The team wants to write, review, and unit-test orchestration in standard programming languages.
  • Fine-grained control of state and application behavior in code is more valuable than a visual state-machine view.
  • Long waits or interruptions make checkpointing and resumption useful.

Choose Step Functions when

  • Operators or developers need a visual representation of the workflow.
  • The orchestration should be a standalone layer rather than part of Lambda code.
  • The workflow spans services or APIs and benefits from Step Functions’ broad native integration set.
  • Keeping orchestration independent of Lambda is an important design requirement.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Can the two approaches be combined?

Yes. AWS describes hybrid designs in which durable functions handle application-level logic inside Lambda, while Step Functions coordinates the higher-level workflow across services. This can keep detailed Lambda behavior close to its code while giving the wider process a separate orchestration layer.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.