Build resilient, long-running AWS Lambda functions that automatically checkpoint progress and resume after failures. Durable functions can run for up to one year while you pay only for active compute time.
Key Features
Automatic Checkpointing – Progress is saved after each step; failures resume from the last checkpoint
Cost-Effective Waits – Suspend execution for minutes, hours, or days without compute charges
Configurable Retries – Built-in retry strategies with exponential backoff and jitter
Replay Safety – Functions deterministically resume from checkpoints after interruptions
Type Safety – Full generic type support for step results
Data-Driven Concurrency – Apply a function across a collection with map(), with per-item error isolation and configurable completion criteria
How It Works
Your durable function extends DurableHandler<I, O> and implements handleRequest(I input, DurableContext ctx). The DurableContext is your interface to durable operations:
ctx.step() – Execute code and checkpoint the result
ctx.wait() – Suspend execution without compute charges
ctx.createCallback() – Wait for external events (approvals, webhooks)
ctx.waitForCallback() – Simplify callback handling by combining callback creation and submission in one operation
ctx.invoke() – Invoke another Lambda function, durable or standard, and wait for the result
ctx.runInChildContext() – Run an isolated child context with its own checkpoint log
ctx.map() – Apply a function to each item in a collection concurrently
ctx.parallel() - Run multiple operations concurrently with optional concurrency control
ctx.waitForCondition() – Poll a condition function until it signals done, suspending between polls
public class OrderProcessor extends DurableHandler<Order, OrderResult> {
@Override
protected OrderResult handleRequest(Order order, DurableContext ctx) {
// Step 1: Validate and reserve inventory
var reservation = ctx.step("reserve-inventory", Reservation.class,
stepCtx -> inventoryService.reserve(order.getItems()));
// Step 2: Process payment
var payment = ctx.step("process-payment", Payment.class,
stepCtx -> paymentService.charge(order.getPaymentMethod(), order.getTotal()));
// Wait for warehouse processing (no compute charges)
ctx.wait(null, Duration.ofHours(2));
// Step 3: Confirm shipment
var shipment = ctx.step("confirm-shipment", Shipment.class,
stepCtx -> shippingService.ship(reservation, order.getAddress()));
return new OrderResult(order.getId(), shipment.getTrackingNumber());
}
}
Filesystem Serialization
For large operation payloads, the SDK includes Filesystem SerDes,
which stores values on a durable shared mount and checkpoints a small file reference.
Deployment
See examples/README.md for complete instructions on local testing and running cloud integration tests.
AWS Lambda Durable Execution SDK for Java
Build resilient, long-running AWS Lambda functions that automatically checkpoint progress and resume after failures. Durable functions can run for up to one year while you pay only for active compute time.
Key Features
map(), with per-item error isolation and configurable completion criteriaHow It Works
Your durable function extends
DurableHandler<I, O>and implementshandleRequest(I input, DurableContext ctx). TheDurableContextis your interface to durable operations:ctx.step()– Execute code and checkpoint the resultctx.wait()– Suspend execution without compute chargesctx.createCallback()– Wait for external events (approvals, webhooks)ctx.waitForCallback()– Simplify callback handling by combining callback creation and submission in one operationctx.invoke()– Invoke another Lambda function, durable or standard, and wait for the resultctx.runInChildContext()– Run an isolated child context with its own checkpoint logctx.map()– Apply a function to each item in a collection concurrentlyctx.parallel()- Run multiple operations concurrently with optional concurrency controlctx.waitForCondition()– Poll a condition function until it signals done, suspending between pollsQuick Start
Installation
Your First Durable Function
Filesystem Serialization
For large operation payloads, the SDK includes Filesystem SerDes, which stores values on a durable shared mount and checkpoints a small file reference.
Deployment
See examples/README.md for complete instructions on local testing and running cloud integration tests.
See Deploy and invoke Lambda durable functions with the AWS CLI for more information on deploying and invoking durable functions.
See Deploy Lambda durable functions with Infrastructure as Code for more information on deploying durable functions using infrastructure-as-code.
Documentation
Core Operations
Examples
Advanced Topics
v1.2.1Related SDKs
Security
See CONTRIBUTING for information about reporting security issues.
License
This project is licensed under the Apache-2.0 License. See LICENSE for details.