Skip to main content

Serverless Workers Interactive Demo

Serverless Workers let you run Temporal Workers on serverless compute like AWS Lambda. There are no long-lived processes to provision or scale. Temporal Cloud invokes your Worker when Tasks arrive, and the Worker shuts down when the work is done.

Use the interactive demo below to explore how the configuration options affect the generated Worker code, deployment script, and CLI commands. Click "Start Workflow" to simulate the end-to-end Serverless Worker invocation flow.

Serverless Worker Flow

Start
Client
Task Queue
No pollers
Temporal
Invokes Lambda
Worker
Lambda
Done
Result

Execution Log

Click “Simulate Workflow” to see the serverless worker flow in action

Configuration

Simulated logs
The execution log above is a simplified, combined view for educational purposes. In a real Serverless Worker execution, logs are distributed across different services (Temporal, AWS Lambda, your application) with varying visibility.

Step-by-step walkthrough

Step 1: Worker Code

package main

import (
lambdaworker "go.temporal.io/sdk/contrib/aws/lambdaworker"
"go.temporal.io/sdk/worker"
"go.temporal.io/sdk/workflow"
)

func main() {
lambdaworker.RunWorker(worker.WorkerDeploymentVersion{
DeploymentName: "my-app",
BuildID: "build-1",
}, func(opts *lambdaworker.Options) error {
opts.TaskQueue = "serverless-task-queue"

opts.RegisterWorkflowWithOptions(MyWorkflow, workflow.RegisterOptions{
VersioningBehavior: workflow.VersioningBehaviorAutoUpgrade,
})
opts.RegisterActivity(MyActivity)

return nil
})
}

Next steps