AWS Lambda Durable Execution SDK Examples
July 9, 2026 · View on GitHub
Example applications demonstrating the AWS Lambda Durable Execution SDK for Java.
Prerequisites
- Java 17+
- Maven 3.8+
- AWS SAM CLI (for deployment)
- AWS credentials configured
Local Testing
Run examples locally without deploying to AWS using LocalDurableTestRunner:
# Build and install the SDK to local Maven repo (required since SDK is not yet published)
mvn clean install -DskipTests # from project root
cd examples
# Run all tests
mvn test
# Run specific test
mvn test -Dtest=SimpleStepExampleTest
The local runner executes in-memory and skips wait durations—ideal for fast iteration and CI/CD.
Deploy to AWS
cd examples
mvn clean package
sam build
sam deploy --guided
On first deploy, SAM will prompt for stack name and region. Subsequent deploys use saved config:
sam deploy
The SAM template configures:
DurableConfigwithExecutionTimeoutandRetentionPeriodInDays- IAM permissions for
lambda:CheckpointDurableExecutionsandlambda:GetDurableExecutionState
Invoke Deployed Functions
sam remote invoke SimpleStepExampleFunction \
--event '{"name":"World"}' \
--stack-name durable-sdk-examples
Cloud Integration Tests
Run tests against deployed functions using CloudDurableTestRunner:
cd examples
mvn test -Dtest=CloudBasedIntegrationTest -Dtest.cloud.enabled=true
The tests auto-detect your AWS account and region from credentials. Override if needed:
mvn test -Dtest=CloudBasedIntegrationTest \
-Dtest.cloud.enabled=true \
-Dtest.aws.account=123456789012 \
-Dtest.aws.region=us-east-1
Examples
| Example | Description |
|---|---|
| SimpleStepExample | Basic sequential steps |
| WaitExample | Suspend execution with wait() |
| RetryExample | Configuring retry strategies |
| ErrorHandlingExample | Handling StepFailedException and StepInterruptedException |
| GenericTypesExample | Working with List<T> and Map<K,V> |
| CustomConfigExample | Custom Lambda client and SerDes |
| WaitAtLeastExample | Concurrent stepAsync() with wait() |
| WaitAsyncExample | Non-blocking waitAsync() with concurrent step |
| RetryInProcessExample | In-process retry with concurrent operations |
| WaitAtLeastInProcessExample | Wait completes before async step (no suspension) |
| ManyAsyncStepsExample | Performance test with 500 concurrent async steps |
| SimpleMapExample | Concurrent map over a collection with durable steps |
| CustomShouldCompleteMapExample | Custom map completion with shouldComplete decisions |
| WaitForConditionExample | Poll a condition until met with waitForCondition() |
| OtelExample | OpenTelemetry instrumentation with logging span export |
| OtelXRayStepExample | Export step spans to X-Ray through the ADOT Lambda Layer |
| OtelXRayWaitExample | Trace a step-wait-step workflow across Lambda invocations |
| OtelXRayMapExample | Trace concurrent map operations and item steps in X-Ray |
| OtelXRayParallelExample | Trace parallel branches and branch steps in X-Ray |
| OtelXRayNestedContextExample | Trace nested child contexts and inner steps in X-Ray |
Cleanup
sam delete