Skip to main content
Deploy your Restate services as serverless functions on AWS Lambda. This guide covers project setup, packaging, IAM permissions, service registration, and invocation. There are two ways to deploy a Restate service on AWS Lambda:
  • Use AWS CDK to start from a complete example that configures the Lambda deployment and its registration with Restate.
  • Deploy manually and automate subsequent deployments and registration with GitHub Actions.

Deploy with AWS CDK

For a new Lambda deployment, we recommend starting from the TypeScript AWS CDK example:
Then follow the example README to configure your AWS and Restate Cloud environment and deploy the stack. The example uses the @restatedev/restate-cdk construct library to deploy the Lambda function, configure its execution and invoker roles, grant invocation permission, and register the published function version with Restate Cloud. CDK examples are also available for Go, Java, and Kotlin.

Deploy manually

IAM roles used in the manual workflow

Three different IAM roles appear in the instructions. Each role has a separate purpose and is assumed by a different actor: These roles are not interchangeable. In particular, Restate assumes the invoker role, while Lambda runs the function with the execution role.
1

Set up your project

Start from the TypeScript Lambda template.

Create your Restate + TypeScript + Lambda repository

Or convert your existing service to a Lambda handler.
2

Package your function

Build a deployment package containing your application code and dependencies.
Package your application as a zip file for Lambda:
3

Deploy the Lambda function

Create the function in the AWS Lambda console and upload the deployment package. For more details, follow the AWS Lambda documentation.When you create the function, AWS requires a Lambda execution role. Lambda assumes this role while your handler runs. Give it only the permissions the handler needs, such as permission to write logs or access application resources. This is not the role that Restate assumes to invoke the function.Configure the handler for your SDK:
4

Allow Restate to invoke the function

Configure how your Restate environment authenticates to AWS:
Create a Restate invoker role in the same AWS account as your function. Restate assumes this role to call lambda:InvokeFunction. You can copy the IAM trust policy for your environment, in the Restate Cloud UI at Developers > Security > AWS Lambda.The role’s trust policy is configured so that only the Restate Cloud environments you specify can assume it. The role’s permissions policy should grant lambda:InvokeFunction only for the function you deployed.
The invoker role is separate from the function’s execution role. The execution role grants permissions to the function while it runs; the invoker role grants Restate permission to invoke the function, and nothing else.
An appropriately scoped AWS identity and IAM trust policy prevent unauthorized callers from invoking the function through AWS Lambda. You do not need request identity validation in this case, although request identity validation also works with Lambda endpoints if you want an additional check in the service itself.
5

Register the service with Restate

Register the Lambda function with Restate using the CLI or UI:
<INVOKER_ROLE_ARN> is the Restate invoker role from the previous step, not the Lambda execution role. For Restate Cloud/BYOC, provide this role when registering the deployment. For Restate OSS, provide it if Restate assumes a separate invoker role; omit --assume-role-arn if the AWS identity used by Restate already has permission to invoke the function.
Always register a specific Lambda version (not $LATEST) to ensure Restate routes requests to a stable deployment. Check the versioning documentation for more info.
6

Send your first request

You’re set up! Go to the Overview page > Greeter > Playground and start sending requests to your service.

CI/CD Automation

You can set up automation to upload a new Lambda version and register a new Restate service versions on every push to main.
If you’ve followed the steps above, then you already have the GitHub Actions workflow set up. All you need to do is to add the secrets below to your project.
Create the Lambda function before the first workflow run. The workflow publishes a new version of an existing function, it does not create one.
The workflow references two role ARNs for different operations. The AWS credentials step makes GitHub Actions assume AWS_DEPLOY_ROLE_TO_ASSUME. The registration step passes AWS_INVOKE_ROLE_TO_ASSUME to Restate so that Restate—not GitHub Actions—can assume it when invoking the function.
.github/workflows/deploy.yml
This workflow needs the following GitHub Actions repository secrets:
  • RESTATE_ADMIN_URL: The Admin URL. You can find it in Developers > Admin URL
  • RESTATE_AUTH_TOKEN: Your Restate Cloud auth token. To get one, go to Developers > API Keys > Create API Key, and make sure to select Admin for the role
  • AWS_INVOKE_ROLE_TO_ASSUME: The Restate invoker role created in Allow Restate to invoke the function. Restate assumes this role when calling the published Lambda version
  • AWS_DEPLOY_ROLE_TO_ASSUME: The CI/CD deploy role that GitHub Actions assumes to update and publish the function, as described below
For either workflow, configure your AWS account for the GitHub OIDC provider.
To configure your account for the GitHub OIDC provider, run:
To create the CI/CD deploy role, head over to the AWS IAM console and create a new role. GitHub Actions assumes this role through OIDC; Restate never assumes it.The role should have the following Trust policy:
And the following permissions:
The policy above follows the deployment action’s documented permission set. The iam:PassRole permission must be scoped to the Lambda execution role assigned to the function. The action needs it only when it creates a function or assigns a different execution role; the update-only workflow shown here does not normally exercise it. Do not grant iam:PassRole on the Restate invoker role.