Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 1.8 KB

README.md

File metadata and controls

44 lines (28 loc) · 1.8 KB

graalvm-scala-lambda

A Hello, World app for AWS Lambda. Written in Scala, compiled with the GraalVM and executed with the AWS Lambda Custom Runtime.

This is the example project for my AWS Lambda, Scala, and GraalVM blog post.

Requirements

This project uses SBT for building Scala projects, Docker for further compiling the Scala code to a linux executable, and Amazon's SAM CLI app for testing/packaging/deploying AWS Lambda functions. You'll need all of the following to run the project:

  1. SBT
    • The Scala Build Tool
  2. SAM CLI
    • The AWS Serverless Application Model app (a wrapper around AWS CloudFormation and the CLI)
  3. AWS CLI
    • The popular CLI for accessing the AWS API
  4. Docker
    • Required by SAM for local testing of Lambda functions
  5. curl
    • The performant web client used to test the running Lambda functions
  6. An AWS account and valid credentials
    • Allows the SAM tool to deploy your function to API Gateway / AWS Lambda

Building and Running The Function Locally

Open your terminal to the project directory and run the following to build and run the function locally:

$ ./build.sh && sam local start-api

Open a separate terminal in the same directory and test out the function with curl:

$ curl http://127.0.0.1:3000/hello/developer
Hello, developer

The Hello, $name response from the function appears, with the name taken from the path parameter following the hello/ segment.

See the post for the remaining instructions on uploading and deploying your function to AWS Lambda.