AWS Lambda durable functions - Human in the loop

AWS Lambda durable functions → Amazon DynamoDB

A durable function expense approval workflow that pauses execution to wait for a manager's approval callback, with a 72-hour durable timer fallback.

This pattern deploys a Lambda durable function that implements an expense approval workflow. After an expense is submitted, the function creates a callback token and suspends execution — incurring zero compute cost while waiting for a manager's decision.
A manager can approve or reject the expense via a separate API endpoint that sends the callback. If no response arrives within 72 hours, a durable timer automatically rejects the expense.
This demonstrates the human-in-the-loop pattern with Lambda durable functions: WaitForCallback for external events, durable timers for deadlines, and DynamoDB for persisting expense state.

< 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/sam-dotnet-durablefunction-expenseapproval

Deploy

sam buildsam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.

Created by:

Doug Perkes

Doug Perkes

Senior Solutions Architect at AWS, focused on .NET and serverless.

Follow on LinkedIn