Function chaining with AWS Lambda durable functions

AWS Lambda durable functions → AWS Lambda → AWS Lambda

Demonstrates the function chaining pattern using Lambda durable functions with automatic checkpointing and fault-tolerant sequential execution

This pattern demonstrates the function chaining pattern using Lambda durable functions.
A durable orchestrator function chains three Lambda functions sequentially using context.invoke().
Each invocation creates an automatic checkpoint, enabling the workflow to resume from the last successful step after failures.
Step 1 (Add) initializes data and adds 10 to the input value.
Step 2 (Transform) doubles the value and transforms the name to uppercase.
Step 3 (Finalize) adds 5 to the value and sets the completion status.
The pattern showcases fault-tolerant workflow orchestration without managing state infrastructure.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/lambda-durable-function-chaining-sam

Deploy

sam buildsam deploy --guided


Testing

Get the orchestrator alias ARN from stack outputs:
DURABLE_FUNCTION_ARN=$(aws cloudformation describe-stacks --stack-name durable-function-chaining --query 'Stacks[0].Outputs[?OutputKey==`OrchestratorAliasArn`].OutputValue' --output text)
Invoke the workflow:
aws lambda invoke --function-name "$DURABLE_FUNCTION_ARN" --payload '{"id": "test-123", "name": "demo", "value": 5}' --cli-binary-format raw-in-base64-out response.json
cat response.json
Expected output shows value transformation: 5 → +10 (step1) → ×2 (step2) → +5 (step3) = 35

Cleanup

Delete the stack: sam delete

Created by:

Sahil Bhimjiani

Sahil Bhimjiani

Sahil Bhimjiani is a Solutions Architect at Amazon Web Services.

Follow on LinkedIn

Anup Rajpara

Anup Rajpara

Anup is passionate about serverless & event-driven architectures.

Follow on LinkedIn