TemporalGarima Gupta11 min readintermediate
From dedicated Workers to Serverless Workers: Migrating Temporal Workflows to AWS Lambda
Summary
Temporal’s Serverless Workers let you replace always‑on Kubernetes Workers with on‑demand Lambda invocations. The guide shows how to add a Lambda handler, configure worker versioning, tune shutdown timeouts for long‑running activities, package dependencies for Lambda, and deploy the function, keeping workflow and activity code unchanged.
- Serverless Workers use the same SDK; only the entry‑point changes to a Lambda handler built with `run_worker()`.
- Worker versioning (PINNED vs AUTO_UPGRADE) is required; you can set it per workflow or as a worker default.
- For activities longer than a few seconds, align three timeouts: worker stop timeout, shutdown deadline buffer, and Lambda’s invocation timeout (max 15 min).
- Package dependencies in a Linux‑compatible layer, trim to stay under Lambda’s 250 MB unzipped limit, and strip binaries if needed.
Serverless Workers eliminate the need for a dedicated worker fleet for bursty or infrequent workloads, reducing operational overhead and cost while preserving Temporal’s reliability guarantees. Proper timeout tuning and packaging are essential to avoid mid‑activity termination and deployment failur…
6/10




