All Projects → nervous-systems → Cljs Lambda

nervous-systems / Cljs Lambda

Licence: unlicense
Utilities around deploying Clojurescript functions to AWS Lambda

Programming Languages

clojure
4091 projects
clojurescript
191 projects

Projects that are alternatives of or similar to Cljs Lambda

Aws Serverless Samfarm
This repo is full CI/CD Serverless example which was used in the What's New with AWS Lambda presentation at Re:Invent 2016.
Stars: ✭ 271 (-10.86%)
Mutual labels:  aws, serverless, aws-lambda
Aws Auto Cleanup
Open-source application to programmatically clean your AWS resources based on a whitelist and time to live (TTL) settings
Stars: ✭ 276 (-9.21%)
Mutual labels:  aws, serverless, aws-lambda
Dialetus Service
API to Informal dictionary for the idiomatic expressions that each Brazilian region It has
Stars: ✭ 202 (-33.55%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Architecture Boilerplate
📦 ⚡️ 🚀 Boilerplate to organize and deploy big projects using AWS API Gateway and AWS Lambda with Serverless Framework
Stars: ✭ 269 (-11.51%)
Mutual labels:  aws, serverless, aws-lambda
Algnhsa
AWS Lambda Go net/http server adapter
Stars: ✭ 226 (-25.66%)
Mutual labels:  aws, serverless, aws-lambda
Rust Crowbar
Wrapper to simplify writing AWS Lambda functions in Rust (using the Python execution environment)
Stars: ✭ 198 (-34.87%)
Mutual labels:  aws, serverless, aws-lambda
Laconia
Create well-crafted serverless applications, effortlessly
Stars: ✭ 260 (-14.47%)
Mutual labels:  aws, serverless, aws-lambda
Components
The Serverless Framework's new infrastructure provisioning technology — Build, compose, & deploy serverless apps in seconds...
Stars: ✭ 2,259 (+643.09%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+763.49%)
Mutual labels:  aws, serverless, aws-lambda
Aws Lambda Haskell Runtime
⚡Haskell runtime for AWS Lambda
Stars: ✭ 223 (-26.64%)
Mutual labels:  aws, serverless, aws-lambda
Aws Lambda Power Tuning
AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.
Stars: ✭ 3,040 (+900%)
Mutual labels:  aws, serverless, aws-lambda
Serverlessbydesign
A visual approach to serverless development. Think. Build. Repeat.
Stars: ✭ 254 (-16.45%)
Mutual labels:  aws, serverless, aws-lambda
Aws Cdk Changelogs Demo
This is a demo application that uses modern serverless architecture to crawl changelogs from open source projects, parse them, and provide an API and website for viewing them.
Stars: ✭ 197 (-35.2%)
Mutual labels:  aws, serverless, aws-lambda
Aws To Slack
Forward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack.
Stars: ✭ 261 (-14.14%)
Mutual labels:  aws, serverless, aws-lambda
Terraform Aws Lambda
Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations
Stars: ✭ 190 (-37.5%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Haskell
Deploying Haskell applications to AWS Lambda with Serverless
Stars: ✭ 204 (-32.89%)
Mutual labels:  aws, serverless, aws-lambda
Chrome Aws Lambda
Chromium Binary for AWS Lambda and Google Cloud Functions
Stars: ✭ 2,502 (+723.03%)
Mutual labels:  aws, serverless, aws-lambda
Middy
🛵 The stylish Node.js middleware engine for AWS Lambda
Stars: ✭ 2,592 (+752.63%)
Mutual labels:  aws, serverless, aws-lambda
Retinal
🏙 Retinal is a Serverless AWS Lambda service for resizing images on-demand or event-triggered
Stars: ✭ 208 (-31.58%)
Mutual labels:  aws, serverless, aws-lambda
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (-25%)
Mutual labels:  aws, serverless, aws-lambda

cljs-lambda

Build Status

AWS Lambda is a service which allows named functions to be directly invoked (via a client API), have their execution triggered by a variety of AWS events (S3 upload, DynamoDB activity, etc.) or to serve as HTTP endpoints (via API Gateway).

This README serves to document a Leiningen plugin (lein-cljs-lambda), template (cljs-lambda) and small library (cljs-lambda) to facilitate the writing, deployment & invocation of Clojurescript Lambda functions.

The plugin can deploy functions itself, or the excellent Serverless framework can be used, via serverless-cljs-plugin.

Benefits

  • Low instance warmup penalty
  • Use promises, or asynchronous channels for deferred completion
  • :optimizations :advanced support, for smaller zip files*
  • Utilities for testing Lambda entrypoints off of EC2
  • Function publishing/versioning
  • Serverless integration

N.B. If using advanced compilation alongside Node's standard library, something like cljs-nodejs-externs will be required

Status

This collection of projects is used extensively in production, for important pieces of infrastructure. While efforts are made to ensure backward compatibility in the Leiningen plugin, the cljs-lambda API is subject to breaking changes.

Recent Changes

  • io.nervous/lein-cljs-lambda 0.6.0 defaults the runtime of deployed functions to nodejs4.3, unless this is overriden with :runtime in the fn-spec or on the command-line. While your functions will be backwards compatible, your AWS CLI installation may require updating to support this change.

Coordinates

Plugin

Clojars Project

Library

Clojars Project

Get Started

$ lein new cljs-lambda my-lambda-project
$ cd my-lambda-project
$ lein cljs-lambda default-iam-role
$ lein cljs-lambda deploy
### 500ms delay via a promise (try also "delay-channel" and "delay-fail")
$ lein cljs-lambda invoke work-magic \
  '{"spell": "delay-promise", "msecs": 500, "magic-word": "my-lambda-project-token"}'
... {:waited 500}
### Get environment varibles
$ lein cljs-lambda invoke work-magic \
  '{"spell": "echo-env", "magic-word": "my-lambda-project-token"}'
...
$ lein cljs-lambda update-config work-magic :memory-size 256 :timeout 66

Serverless

To generate a minimal project:

$ lein new serverless-cljs my-lambda-project

Documentation

Older

Other

Function Examples

(Using promises)

(deflambda slowly-attack [{target :name} ctx]
  (p/delay 1000 {:to target :data "This is an attack"}))

AWS Integration With eulalie

(Using core.async)

This function retrieves the name it was invoked under, then attempts to invoke itself in order to recursively compute the factorial of its input:

(deflambda fac [n {:keys [function-name] :as ctx}]
  (go
    (if (<= n 1)
      n
      (let [[tag result] (<! (lambda/request! (creds/env) function-name (dec n)))]
        (* n result)))))

See the eulalie.lambda.util documentation for further details.

N.B. Functions interacting with AWS will require execution under roles with the appropriate permissions, and will not execute under the placeholder IAM role created by the plugin's default-iam-role task.

Further Examples

Using SNS & SQS from Clojurescript Lambda functions is covered in this working example, and the blog post which discusses it.

Invoking

CLI

$ lein cljs-lambda invoke my-lambda-fn '{"arg1": "value" ...}' [:region ...]

Programmatically

If you're interested in programmatically invoking Lambda functions from Clojure/Clojurescript, it's pretty easy with eulalie:

(eulalie.lambda.util/request!
 {:access-key ... :secret-key ... [:token :region etc.]}
 "my-lambda-fn"
 {:arg1 "value" :arg2 ["value"]})

License

cljs-lambda is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].