Skip to content

v0.2.0 — Lambda Container Migration

Choose a tag to compare

@serithemage serithemage released this 14 Mar 22:13
· 15 commits to main since this release

Highlights

OpenClaw now runs directly in AWS Lambda, eliminating all fixed compute costs. The Fargate runtime remains available as a fallback.

  • Zero idle cost: Lambda charges only per invocation (~$0.00005/request)
  • 1.35s cold start: Down from 55.9s (97.6% reduction)
  • 0.12s warm start: Down from 34.6s (99.7% reduction)
  • Zero OpenClaw modifications: Wrapper-only approach, fully upstream-compatible

New Features

  • Lambda Agent Runtime (packages/lambda-agent/): Runs OpenClaw's runEmbeddedPiAgent() in a Lambda Container Image (ARM64, 2048MB, 15min timeout)
  • S3 Session Persistence: Session files (JSONL) synced between S3 and Lambda /tmp for cross-invocation continuity
  • DynamoDB Session Lock: Conditional writes prevent concurrent session corruption
  • AGENT_RUNTIME Feature Flag: fargate (default) | lambda | both — controls which compute path is deployed
  • CDK LambdaAgentStack: ECR repository, DockerImageFunction, IAM (S3 + SSM + DynamoDB + CloudWatch)
  • /lambda-migration Claude Code skill: Guided implementation for each migration step

Performance

Metric Before (Fargate) After (Lambda) Change
Cold start 55.9s 1.35s -97.6%
Warm start 34.6s 0.12s -99.7%
Idle cost ~$15/month $0 -100%
Memory (warm) 1,270 MB 119 MB -90.6%

Breaking Changes

None. Default AGENT_RUNTIME=fargate preserves existing behavior.

Deployment Notes

  • Docker build requires --provenance=false (Lambda doesn't support OCI manifests)
  • ECR repository must be pre-created before first deploy
  • CDK Bootstrap v30+ required (cdk bootstrap to update)
  • Current operational mode: both (Lambda primary, Fargate fallback)

Test Coverage

233 unit tests + 35 E2E tests = 268 total, all passing

Key Technical Decisions

  • file:// URL import bypasses Node.js exports map for OpenClaw's extensionAPI.js
  • Bedrock discovery disabled via config (bedrockDiscovery.enabled: false) — saves ~54s per invocation
  • OpenClaw module cached across warm invocations for 0.12s response time
  • Session files synced via S3 with DynamoDB conditional-write locking

Full migration journey: docs/lambda-migration-journey.md

🤖 Generated with Claude Code