From dedicated Workers to Serverless Workers: Migrating Temporal Workflows to AWS Lambda

This post details the migration of Temporal Workflows from dedicated Workers on Kubernetes to Serverless Workers on AWS Lambda using the Python SDK. It covers the architecture of Serverless Workers driven by a Worker Controller Instance (WCI) that reacts to sync match failures and task queue backlogs. Key migration steps include adding a Lambda handler using `temporalio.contrib.aws.lambda_worker`, configuring Worker Versioning (PINNED or AUTO_UPGRADE), tuning shutdown timings for long-running Activities (graceful_shutdown_timeout, shutdown_deadline_buffer, and Lambda invocation timeout), packaging dependencies with consideration for cross-platform builds (e.g., macOS to Linux), and trimming packages to fit Lambda's size limits. It also touches on the independent nature of each Lambda invocation and the lack of shared state or connection reuse.