This demo project uses GraalVM to compile a simple Scala project into a single native executable file. As a result, the application can run without Java/JVM installed in the target machine.
See Bootstrap.scala
It utilizes the new AWS Lambda Runtime API to call the native executable as a Lambda Function.
Deployment is powered and managed by the Serverless Framework.
- Linux development machine - This project builds a native binary that is deployed to AWS so it must run in a Linux machine.
- Install NodeJS and the Serverless Framework
- Amazon Web Services account
You also need to setup your AWS credentials/profiles in the ~/.aws/credentials
file.
[dev]
aws_access_key_id = XXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXX
region = us-east-1
To build the project, run ./gradlew clean build
.
This will download all of the project and build dependencies including the GraalVM SDK and will create a native executable file named bootstrap
in the build/graal
directory.
To deploy, simply run sls deploy
. This demo project will create 2 lambda functions: echo
and reverse
:
To invoke the functions, run:
sls invoke -f echo -d 'hello'
sls invoke -f reverse -d 'hello'