Codacy Badge Build Status Maven Central

Writing a handler for AWS lambda in Scala can be as easy as...

import io.circe.generic.auto._
import io.github.mkotsur.aws.handler.Lambda._
import io.github.mkotsur.aws.handler.Lambda
import com.amazonaws.services.lambda.runtime.Context

case class Ping(inputMsg: String)

case class Pong(outputMsg: String)

class PingPongHandler extends Lambda[Ping, Pong] {

  override def handle(ping: Ping, context: Context) = Right(Pong(ping.inputMsg.reverse))

}

The input JSON will be automatically de-serialized into Ping, and the output into Pong. The handle() method is supposed to return Either[Throwable, Pong]: Right if the input was handled correctly, and Left otherwise.

This handler can be used in AWS Lambda as: io.github.mkotsur.example::handle.

Features:

More docs are coming soon... Feel free to look at src/test/scala if you want to use it right now.

Adding to your project

libraryDependencies += "io.github.mkotsur" %% "aws-lambda-scala" % {latest-version}

How does aws-lambda-scala compare with Serverless framework

Short answer: they complement each other. Long anwser: read this blog post.