Skip to main content
The Restate SDK is served as a HTTP handler. You can choose to run this in a standalone HTTP2 server, connect to Restate Cloud/BYOC through an in-process tunnel, or use a FaaS system like Lambda.

Creating a HTTP2 server

  1. Create the Restate Server
  2. Bind one or multiple services to it.
  3. Listen on the specified port for connections and requests.
If you need to customize the HTTP2 server, or serve over HTTP1.1 you can call .Handler() instead of Start(), and then use the handler as normal. To discover services over HTTP1.1 you must provide the --use-http1.1 CLI flag.
By default, this handler will advertise itself as working bidirectionally; the SDK will try to get completions from the runtime during execution.However, you can use the method .Bidirectional(false) on the endpoint builder to change this on platforms that do not support bidirectional communication, such as Lambda. If you don’t do this your handler may get stuck.

Connecting to Restate Cloud or BYOC

You can connect your service to Restate Cloud or BYOC through an outbound tunnel without exposing an inbound HTTP endpoint. Your service and handler implementations stay the same. Install the tunnel package:
Keep your service bindings and replace the HTTP server’s with the tunnel client.
This example reads its configuration from environment variables: On Kubernetes, the Restate operator supplies the environment ID, region, tunnel name, and signing public key when you use tunnelMode: in-process. Follow the Kubernetes deployment guide to mount the API key and configure the deployment. Outside Kubernetes, you can set these variables yourself, or pass the configuration explicitly as shown in the Containers and VMs guide. That guide also covers creating credentials and registering the tunnel deployment.

Creating a Lambda handler

To register your service as a Lambda function change the endpoint into a Lambda handler with .LambdaHandler(), and pass this handler to lambda.Start.
Have a look at the deployment section for guidance on how to deploy your services on AWS Lambda. The implementation of your services and handlers remains the same across these deployment options.

Validating request identity

SDKs can validate that incoming requests come from a particular Restate instance. You can find out more about request identity in the Security docs