/mill-aws-lambda

Mill plugin to deploy code to AWS Lambda.

Primary LanguageScalaApache License 2.0Apache-2.0

Mill AWS Lambda

License Latest Version

Mill plugin to deploy code to AWS Lambda.

Usage

Import the module in build.sc using mill's $ivy import syntax, and extend AwsLambdaModule in your build definition:

import $ivy.`io.github.bbstilson::mill-aws-lambda:0.2.1`

import io.github.bbstilson.AwsLambdaModule

object project extends AwsLambdaModule {
  def scalaVersion = "2.13.6"

  def s3Bucket = "bucket"
  def s3KeyPrefix = "prefix"
  def lambdaName = "my-lambda-name"
  def lambdaHandler = "org.company.Handler::handle"

  // These two are only required if you want to create a lambda.
  def lambdaMemory = Some(512)
  def lambdaRoleArn = Some("arn:aws:iam::1234567890:role/service-role/lambda-role")
}

Then, to deploy:

mill project.deployLambda

Configuration

Setting Description
s3Bucket The name of an S3 bucket where the lambda code will be stored.
s3KeyPrefix The prefix to the S3 key where the jar will be uploaded.
lambdaName The name to use for this AWS Lambda function.
lambdaHandler Class name and method to be executed.
lambdaMemory The amount of memory available to the function at runtime. Increasing the function's memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB.
lambdaRoleArn The Amazon Resource Name (ARN) of the function's execution role.

Scala Versions

It has been compiled against:

  • 2.13.6
  • 2.12.13

Example Project

Check out the project in the examples directory for a complete example.

License

All code in this repository is licensed under the Apache License, Version 2.0. See LICENSE.