Modern applications rarely consist of one short-running operation. An order may need inventory validation, payment processing, shipment creation, and notification. An AI workflow may call several models, wait for human approval, and continue hours later.
Traditionally, developers solve these problems with queues, databases, custom state machines, retry logic, or workflow services such as AWS Step Functions. AWS Lambda Durable Execution introduces another approach: keep the workflow logic in application code while Lambda manages checkpoints, replay, retries, and suspension.
For C# developers, this becomes particularly interesting with the general availability of the AWS Lambda Durable Execution SDK for .NET. AWS announced the .NET SDK as generally available on July 23, 2026. It provides an idiomatic C# programming model for building resilient, long-running Lambda workflows.
What Is AWS Lambda Durable Execution?
A normal Lambda invocation has a limited execution lifetime. If the function fails halfway through a multi-step process, the application has to determine what was already completed and what needs to run again.
Durable execution changes that model.
A durable Lambda function uses checkpoints and replay. Each durable operation records progress. If the execution is interrupted, Lambda can invoke the function again and replay the workflow while using previously stored results for completed operations.
Conceptually, consider this workflow:
Receive Order
|
v
Validate Order
|
v
Reserve Inventory
|
v
Process Payment
|
v
Wait for Warehouse
|
v
Create Shipment
If the function fails after payment has completed, the workflow does not have to blindly start from the beginning. The completed durable operations can be recovered from checkpoints.
A durable execution can span multiple Lambda invocations and can run for up to one year, while an individual Lambda invocation still has its normal execution limit.
Why Durable Execution Matters for .NET Developers
The important difference is not simply that Lambda can run longer.
The real benefit is that workflow state becomes part of the execution model.
With a traditional Lambda implementation, developers may need to build:
A persistence mechanism for workflow state
Retry handling
Recovery logic
Status tracking
Polling mechanisms
Coordination between Lambda functions
Logic to prevent already-completed work from running again
The .NET durable execution SDK provides these capabilities through a programming model based around IDurableContext and operations such as StepAsync, WaitAsync, callbacks, parallel execution, and durable invocation.
This allows the workflow to remain readable as ordinary C# code.
Installing the .NET Durable Execution SDK
The SDK is distributed as the Amazon.Lambda.DurableExecution NuGet package.
Create a Lambda project and add the package:
dotnet add package Amazon.Lambda.DurableExecution
AWS's current SDK implementation supports both executable and class-library programming models. The class-library model can be used with the managed dotnet10 Lambda runtime, while the executable model explicitly builds the Lambda bootstrap.
For most developers starting a new .NET Lambda application, the class-library approach is straightforward.
Building a Durable Order Workflow
Consider an order-processing workflow with four operations:
Reserve inventory.
Process payment.
Wait for warehouse processing.
Create the shipment.
A simplified implementation looks like this:
using Amazon.Lambda.Core;
using Amazon.Lambda.DurableExecution;
using Amazon.Lambda.Serialization.SystemTextJson;
[assembly: LambdaSerializer(typeof(DefaultLambdaJsonSerializer))]
namespace OrderProcessor;
public class Function
{
public Task<DurableExecutionInvocationOutput> Handler(
DurableExecutionInvocationInput input,
ILambdaContext context)
{
return DurableFunction.WrapAsync<Order, OrderResult>(
Workflow,
input,
context);
}
private async Task<OrderResult> Workflow(
Order order,
IDurableContext ctx)
{
var reservation = await ctx.StepAsync(
async (_, ct) =>
await InventoryService.ReserveAsync(order.Items, ct),
name: "reserve-inventory");
var payment = await ctx.StepAsync(
async (_, ct) =>
await PaymentService.ChargeAsync(
order.PaymentMethod,
order.Total,
ct),
name: "process-payment");
await ctx.WaitAsync(
TimeSpan.FromHours(2),
name: "warehouse-processing");
var shipment = await ctx.StepAsync(
async (_, ct) =>
await ShippingService.ShipAsync(
reservation,
order.Address,
ct),
name: "confirm-shipment");
return new OrderResult(
order.Id,
shipment.TrackingNumber);
}
}
public record Order(
string Id,
IReadOnlyList<OrderItem> Items,
PaymentMethod PaymentMethod,
decimal Total,
Address Address);
public record OrderResult(
string OrderId,
string TrackingNumber);
The important part is the distinction between ordinary code and durable operations.
StepAsync wraps work that should be checkpointed. AWS's .NET SDK documentation shows this pattern for operations such as inventory reservation and payment processing. WaitAsync allows the execution to suspend without continuing to consume compute while it waits.
Understanding Checkpoint and Replay
Suppose reserve-inventory succeeds and process-payment also succeeds.
The execution then reaches:
await ctx.WaitAsync(
TimeSpan.FromHours(2),
name: "warehouse-processing");
The durable execution can suspend at this point.
When the workflow resumes, the application code is replayed. However, previously completed durable operations use their checkpointed results rather than performing the same business operation again.
That distinction is critical.
A developer should not assume that the Lambda handler itself runs only once. A durable execution can contain multiple invocations and replays.
The Most Important Rule: Make Workflow Code Deterministic
Replay introduces an important programming constraint.
Code that participates in the workflow must produce consistent results when replayed. Operations that can return different results should generally be placed inside an appropriate durable operation.
For example, avoid relying on an uncontrolled random value in orchestration logic:
var requestId = Guid.NewGuid().ToString();
If that value influences workflow state, replay can produce a different value.
Instead, generate values that need to survive replay inside a checkpointed operation:
var requestId = await ctx.StepAsync(
async (_, ct) =>
{
await Task.CompletedTask;
return Guid.NewGuid().ToString();
},
name: "generate-request-id");
The broader principle is simple: external side effects and nondeterministic work should not accidentally become part of replay-sensitive orchestration code.
This is one of the biggest differences between writing an ordinary Lambda handler and writing a durable workflow.
Handling Long Waits
One of the strongest use cases for durable execution is waiting.
For example:
await ctx.WaitAsync(
TimeSpan.FromHours(24),
name: "customer-confirmation-window");
A normal function should not remain alive for 24 hours simply waiting for an event.
Durable execution can suspend the workflow and resume it later. AWS states that waits suspend execution without consuming compute charges, making the model suitable for workflows that may wait minutes, hours, or days.
Typical examples include:
Customer approval
Payment confirmation
External API completion
Document processing
Human-in-the-loop AI workflows
Scheduled follow-up operations
For events rather than fixed-duration waits, the SDK also provides callback and condition-based operations.
Durable Execution vs AWS Step Functions
Durable execution does not make Step Functions obsolete. The two services solve related but different architectural problems.
Join the conversation! Your thoughts help the community grow.