A more passionate way to write AWS Lambda functions
Switch branches/tags
Nothing to show
Clone or download
Failed to load latest commit information.
example Bump deps in example project. Jun 13, 2016
src/uswitch/lambada Remove `ClojureLambdaBase`. Jun 13, 2016
.gitignore More docs. Jun 17, 2015
LICENSE Update project with license Jun 17, 2015
README.md README Jun 17, 2015
project.clj 0.1.3-SNAPSHOT Jun 13, 2016



Create more passionate AWS Lambda functions using clojure.

Current version:

Clojars Project


You can define a Lambda handler using the deflambdafn macro provided by uswitch.lambada.core:

(ns example.lambda
  (:require [uswitch.lambada.core :refer [deflambdafn]]))

(deflambdafn example.lambda.MyLambdaFn
  [in out ctx]
  (println "OMG I'm running in the cloud!!!111oneone"))

When this namespace is AOT compiled, it will generate a class called example.lambda.MyLambdaFn that implements the AWS Lambda RequestStreamHandler interface using the args and body provided.

Simplest way to deploy is to create an uberjar using leiningen or boot and then use that as the JAR you upload to AWS Lambda. Assuming you have an uberjar called my-lambda-project.jar in target, the following commands will do the job:

$ aws lambda create-function \
    --region eu-west-1 \
    --function-name my-lambda-project \
    --zip-file fileb://$(pwd)/target/my-lambda-project.jar \
    --role arn:aws:iam::YOUR-AWS-ACCOUNT-ID:role/lambda_basic_execution \
    --handler example.lambda.MyLambdaFn \
    --runtime java8 \
    --timeout 15 \
    --memory-size 512

$ aws lambda invoke \
    --invocation-type RequestResponse \
    --function-name my-lambda-project \
    --region eu-west-1 \
    --log-type Tail \
    --payload '{"some":"input"}' \

See example for an example project.


Copyright © 2015 Ragnar Dahlen.

Distributed under the Eclipse Public License, the same as Clojure.