Introduction to ZIO Lambda
ZIO Lambda is a ZIO-based AWS Custom Runtime compatible with GraalVM Native Image. It lets you write an AWS Lambda function as a ZIO program, with typed JSON events in and typed JSON responses out, and deploy it as a GraalVM native binary.
Installationโ
ZIO Lambda is published for Scala 2.12, 2.13 and 3, and runs on the JVM, including as a GraalVM native image. Add the core module to your build.sbt:
libraryDependencies ++= Seq(
// The runtime: ZLambdaRunner, Context. JVM only. It brings zio-json with it
"dev.zio" %% "zio-lambda" % "1.0.7"
)
Modulesโ
The event and response modules are optional. Add them when you want ready-made Scala types for AWS events and responses:
libraryDependencies ++= Seq(
// Scala types for the events that AWS services send to Lambda. JVM only
"dev.zio" %% "zio-lambda-event" % "1.0.7",
// Scala types for the responses that some AWS integrations expect. JVM only
"dev.zio" %% "zio-lambda-response" % "1.0.7"
)
See Event and Response Types for what the two modules contain.
Where to Go Nextโ
- Getting Started shows how to write a handler with custom event and response types.
- The Reference section describes
ZLambdaRunner,Contextand every event and response type. - Build an HTTP API walks through an HTTP API on API Gateway step by step.
- The how-to guides cover testing a handler locally and deploying it to AWS Lambda.