Skip to main content
Restate services can run in two ways: as an HTTP endpoint or as AWS Lambda functions.

Creating an HTTP endpoint

  1. Use either or as SDK dependency.
  2. Create an endpoint
  3. Bind one or multiple services to it
  4. Listen on the specified port (default 9080) for connections and requests.
import dev.restate.sdk.endpoint.Endpoint;
import dev.restate.sdk.http.vertx.RestateHttpServer;

class MyApp {
  public static void main(String[] args) {
    RestateHttpServer.listen(
        Endpoint.bind(new MyService()).bind(new MyObject()).bind(new MyWorkflow()), 8080);
  }
}

Creating a Lambda handler

  1. Use either or as SDK dependency.
  2. Extend the class BaseRestateLambdaHandler
  3. Override the register method
  4. Bind one or multiple services to the builder
import dev.restate.sdk.endpoint.Endpoint;
import dev.restate.sdk.lambda.BaseRestateLambdaHandler;

class MyLambdaHandler extends BaseRestateLambdaHandler {
  @Override
  public void register(Endpoint.Builder builder) {
    builder.bind(new MyService()).bind(new MyObject());
  }
}
The implementation of your services and handlers remains the same for both deployment options. Have a look at the deployment section for guidance on how to deploy your services on AWS Lambda.
If you use a JVM >= 21, you can use virtual threads to run your services:
builder.bind(
    new Greeter(),
    HandlerRunner.Options.withExecutor(Executors.newVirtualThreadPerTaskExecutor()));

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. You will need to use the request identity dependency .
import dev.restate.sdk.auth.signing.RestateRequestIdentityVerifier;
import dev.restate.sdk.endpoint.Endpoint;
import dev.restate.sdk.http.vertx.RestateHttpServer;

class MySecureApp {
  public static void main(String[] args) {
    var endpoint =
        Endpoint.bind(new MyService())
            .withRequestIdentityVerifier(
                RestateRequestIdentityVerifier.fromKeys(
                    "publickeyv1_w7YHemBctH5Ck2nQRQ47iBBqhNHy4FV7t2Usbye2A6f"));
    RestateHttpServer.listen(endpoint);
  }
}
I