- 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:@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.
Set up your project
- TypeScript
- Python
- Java
- Kotlin
- Go
Start from the TypeScript Lambda template.Or convert your existing service to a Lambda handler.
Create your Restate + TypeScript + Lambda repository
Package your function
Build a deployment package containing your application code and dependencies.
- TypeScript
- Python
- Java
- Kotlin
- Go
Package your application as a zip file for Lambda:
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:
Allow Restate to invoke the function
Configure how your Restate environment authenticates to AWS:
- Restate Cloud / BYOC
- Restate OSS
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.
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.Send your first request
- Restate Cloud / BYOC
- Restate OSS
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.Create the Lambda function before the first workflow run. The workflow publishes a new version of an existing function, it does not create one.
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.
- Restate Cloud / BYOC
- Restate OSS
- TypeScript
- Python
.github/workflows/deploy.yml
RESTATE_ADMIN_URL: The Admin URL. You can find it in Developers > Admin URLRESTATE_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 roleAWS_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 versionAWS_DEPLOY_ROLE_TO_ASSUME: The CI/CD deploy role that GitHub Actions assumes to update and publish the function, as described below
GitHub OIDC setup
GitHub OIDC setup
To configure your account for the GitHub OIDC provider, run:
Deploy role set up
Deploy role set up
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.