The micro framework that integrates Clojure with AWS Lambda on either Java, Clojure Native, or Babashka runtime.
io.github.FieryCod/holy-lambda {:mvn/version "0.1.48"}
Interceptors namespace is work in progress and subject to change. Consider it as an alpha.
Supported runtimes
Jump here to learn more and start the journey with the Holy Lambda.
(ns some.ns
(:gen-class)
(:require
[fierycod.holy-lambda.core :as h]
[fierycod.holy-lambda.interceptor :as i]
[fierycod.holy-lambda.native :as native]
[fierycod.holy-lambda.response :as hr]))
(i/definterceptor LambdaLogger
{:enter (fn [request]
(println "REQUEST:" request)
request)
:leave (fn [response]
(println "RESPONSE:" response)
response)})
(h/deflambda ExampleLambda
"I can run on Java, Babashka or Native runtime..."
< {:interceptors [LambdaLogger]}
[{:keys [event ctx]}]
(hr/text "Hello world"))
(native/entrypoint [#'ExampleLambda])
Generate a new project from template via:
clojure -M:new -m clj-new.create holy-lambda basic.example && cd basic.example && bb stack:sync
Alternatively you can use lein new
:
lein new holy-lambda example ;; <-- Replace `example` with the name of the project
It allows you to write one code which might run on Official Java AWS Runtime, Native Custom AWS Runtime built into your codebase or Babashka runtime. Holy Lambda ships with Babashka tasks
to ease development and deployment of an application.
Available tasks:
❯ bb tasks
The following tasks are available:
bucket:create > Creates a s3 bucket using :bucket-name
bucket:remove > Removes a s3 bucket using :bucket-name
----------------------------------------------------------------
docker:build:ee > Builds local image for GraalVM EE
docker:run > Run command in fierycod/graalvm-native-image docker context
----------------------------------------------------------------
native:conf > Provides native configurations for the application
native:executable > Provides native executable of the application
----------------------------------------------------------------
stack:sync > Syncs project & dependencies from either:
- <Clojure> project.clj
- <Clojure> deps.edn
- <Babashka> bb.edn:runtime:pods
stack:compile > Compiles sources if necessary
stack:invoke > Invokes lambda fn (check sam local invoke --help):
- :name - either :name or :stack:default-lambda
- :event-file - path to event file
- :envs-file - path to envs file
- :params - map of parameters to override in AWS SAM
- :debug - run invoke in debug mode
- :logs - logfile to runtime logs to
stack:api > Runs local api (check sam local start-api):
- :debug - run api in debug mode
- :port - local port number to listen to
- :static-dir - assets which should be presented at /
- :envs-file - path to envs file
- :params - map of parameters to override in AWS SAM
stack:pack > Packs Cloudformation stack
stack:deploy > Deploys Cloudformation stack
- :guided - guide the deployment
- :dry - execute changeset?
- :params - map of parameters to override in AWS SAM
stack:describe > Describes Cloudformation stack
stack:doctor > Diagnoses common issues of holy-lambda stack
stack:purge > Purges build artifacts
stack:destroy > Destroys Cloudformation stack & removes bucket
stack:logs > Possible arguments (check sam logs --help):
- :name - either :name or :stack:default-lambda
- :e - fetch logs up to this time
- :s - fetch logs starting at this time
- :filter - find logs that match terms
stack:version > Outputs holy-lambda babashka tasks version
stack:lint > Lints the project
lambada
holy-lambda
.Copyright © 2021 Karol Wojcik aka Fierycod
Released under the MIT license.
Can you improve this documentation? These fine people already did:
Karol Wójcik & Eugene KoontzEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close