Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.54 KB

File metadata and controls

62 lines (45 loc) · 1.54 KB

Lambda Durable Functions with Amazon Bedrock


Stability: Experimental

This is an experimental example. It may not build out of the box

This example uses AWS Lambda Durable Functions (re:Invent 2025 launch) which requires nodejs24.x runtime and the @aws/durable-execution-sdk-js SDK.


This example demonstrates AWS Lambda Durable Functions integrated with Amazon Bedrock to build a multi-step AI content generation workflow with automatic checkpointing.

The Lambda function uses durable execution to:

  1. Generate a blog outline using Bedrock (Claude)
  2. Wait 5 seconds (simulating editorial review)
  3. Expand the outline into a draft
  4. Generate a summary

Each step is automatically checkpointed — if the function fails mid-execution, it resumes from the last completed step rather than restarting.

Architecture

User → Lambda (Durable) → Step 1: Bedrock (outline)
                        → Wait (5s)
                        → Step 2: Bedrock (draft)
                        → Step 3: Bedrock (summary)
                        → Return result

Build

npm install
npm run build

Deploy

npx cdk deploy

Test

aws lambda invoke \
  --function-name <FunctionName> \
  --qualifier <VersionNumber> \
  --payload '{"topic":"AWS Lambda Durable Functions"}' \
  output.json && cat output.json

Cleanup

npx cdk destroy