Demo project convert text to date.
Slides of the presentation can be found here: https://www.slideshare.net/Dainius/clojure-workflow-tokenmill-by-dainius-jocas
Custom AWS Lambda runtime with the Clojure
tools-deps application compiled with GraalVM
Set these environment variables:
Lambda is ready to be used. Go to your AWS Console to work with the new stack named
What is in the package
Most common operations are scripted in the Makefile:
make build-native-image: inside the docker with the GraalVM builds native binary for the lambda and copies it to the project folder two files:
make build-lambda-zip: inside the docker creates a custom AWS lambda runtime zip archive and copies it to the project folder as a
function.zipfile (for manual deployments).
make deploy-custom-runtime-lambda: (use it if you have
awscliinstalled and configured) builds a deployable lambda zip and deploys it to AWS.
make deploy-lambda-via-container: builds lambda zip and deploys to AWS with your provided credentials (set the environment variables (e.g.
(export MY_AWS_DEFAULT_REGION=eu-west-1 && <set other enviroment variables> && make deploy-lambda-via-container)or use something like dotenv, or some other way).
This demo assumes that docker is available in the system.
request->responsefunction to do the work you need.
- When needed add libraries to the
deps.edn(with a little more work Git deps from private git repositories can be achieved).
- Build native image with GraalVM inside a docker
- Configure CI (for environment variables)
- Deploy to AWS Lambda
(defn request->response [request] (let [decoded-request (json/read-value request read-mapper)] (json/write-value-as-string decoded-request)))
.gitlab-ci.yml file includes a demo on how the lambda can be deployed from the Gitlab CI pipeline. Create environment variables in the CI/CD setup of your project.