• Stars
    star
    201
  • Rank 194,491 (Top 4 %)
  • Language
    OCaml
  • License
    BSD 3-Clause "New...
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An OCaml custom runtime for AWS Lambda

OCaml Runtime for AWS Lambda

This package provides a custom runtime for AWS Lambda.

Installation

This repository provides two libraries:

  • lambda-runtime provides a runtime and API for AWS Lambda and API Gateway.
  • the vercel library depends on lambda-runtime and provides an interface to the Vercel service that resembles a request / response exchange.

The libraries in this repo are released to the OPAM package registry.

You can depend on them via:

  1. esy: esy add @opam/lambda-runtime and / or esy add @opam/vercel
  2. OPAM: opam install lambda-runtime vercel.

Example function

See the examples folder.

Deploying

Note: Based on the instructions in this blog post and the Rust custom runtime repository

For a custom runtime, AWS Lambda looks for an executable called bootstrap in the deployment package zip. Rename the generated basic executable to bootstrap and add it to a zip archive.

The Dockerfile (in conjunction with the build.sh script) in this repo does just that. It builds a static binary called bootstrap and drops it in the target directory.

$ ./build.sh && zip -j ocaml.zip bootstrap

Now that we have a deployment package (ocaml.zip), we can use the AWS CLI to create a new Lambda function. Make sure to replace the execution role with an existing role in your account!

$ aws lambda create-function --function-name OCamlTest \
  --handler doesnt.matter \
  --zip-file file://./ocaml.zip \
  --runtime provided \
  --role arn:aws:iam::XXXXXXXXXXXXX:role/your_lambda_execution_role \
  --tracing-config Mode=Active

You can now test the function using the AWS CLI or the AWS Lambda console

$ aws lambda invoke --function-name OCamlTest \
  --payload '{"firstName": "world"}' \
  output.json
$ cat output.json  # Prints: {"message":"Hello, world!"}

Copyright & License

Copyright Β© 2018 AntΓ³nio Nuno Monteiro

Distributed under the 3-clause BSD License (see LICENSE).

More Repositories

1

lumo

Fast, cross-platform, standalone ClojureScript environment
Clojure
1,884
star
2

ocaml-h2

An HTTP/2 implementation written in pure OCaml
OCaml
307
star
3

reason-graphql-fullstack

Fullstack Reason + GraphQL Todo List App
OCaml
248
star
4

piaf

Web library for OCaml with support for HTTP/1.X / HTTP/2
OCaml
170
star
5

archi

An OCaml library for managing the lifecycle of stateful components and their dependencies
OCaml
48
star
6

gluten

Reusable runtime library for network protocols
OCaml
44
star
7

om-next-fullstack

Fullstack application demoing Om Next server-side rendering.
Clojure
37
star
8

ocaml-quic

OCaml
31
star
9

bucklescript-monorepo

Example of a BuckleScript monorepo setup
Reason
31
star
10

github-stars-lambda-demo

OCaml
28
star
11

gh-feed-reader

OCaml
26
star
12

aemette

A batteries-included Leiningen template for Om
Clojure
24
star
13

dotfiles

Vim Script
23
star
14

now-static-bin

Run arbitrary executables in Now 2.0 Lambdas
Go
22
star
15

reason-graphql-experiment

Reason + GraphQL Fullstack (Native) experiment with Now 2.0
JavaScript
21
star
16

now-custom-runtime

ZEIT Now v2.0 builder for custom AWS Lambda runtimes
TypeScript
21
star
17

eio-ssl

OpenSSL bindings to OCaml EIO
OCaml
18
star
18

devcards-om-next

Devcards extension for writing fully reloadable Om Next cards
Clojure
16
star
19

ocaml-mongodb

OCaml
13
star
20

ocaml-subscriptions-transport-ws

Websocket protocol for exchanging GraphQL requests and responses
OCaml
12
star
21

snoopy-mode

Minor mode for number row unshifted character insertion in Emacs
Emacs Lisp
10
star
22

now-rust

Rust
10
star
23

youtube

Reason
9
star
24

graphql-sdl

OCaml
9
star
25

plomber

Component instrumentation for Om Next
Clojure
9
star
26

rekeys

Example ReasonML app to find JavaScript event keycodes.
OCaml
8
star
27

craftconf-demo

7
star
28

websocket-httpaf

OCaml
6
star
29

anmonteiro.github.io

πŸ’Ύ sources for my blog
Clojure
6
star
30

reason-lwt-tutorial

OCaml
6
star
31

ocaml-cpuinfo

OCaml
5
star
32

cra-reason-template

JavaScript
5
star
33

caqti-eio

OCaml
5
star
34

deathrow

πŸ”« Random last statements by executed offenders - web client
Clojure
4
star
35

M101JS

MongoDB University MongoDB for Node.js Developers course
JavaScript
4
star
36

melange-relay

Use Relay with ReScript.
OCaml
4
star
37

nixerve

OCaml
3
star
38

nowtop

OCaml
3
star
39

js-modules-demo

JS Modules demo with Om Next
Clojure
3
star
40

netlify-staging-example

JavaScript
3
star
41

stdlib-merge

OCaml
2
star
42

kubernetes-nixos

Nix
2
star
43

chital

πŸ‚ Scrape web pages for groups of articles
JavaScript
2
star
44

talks

Clojure
2
star
45

clj-isitup

πŸ’Ί isitup.org client, from your code or command line
Clojure
2
star
46

ocaml-sendfile

OCaml
1
star
47

AroundTheCorneriOS

Swift
1
star
48

diy-lisp

my implementation of diy-lisp (from kvalle/diy-lisp)
Python
1
star
49

lumo-demo

Clojure
1
star
50

next-netlify-starter-2

JavaScript
1
star
51

dune-repro

Nix
1
star
52

netlify-graph-nextjs-example

JavaScript
1
star
53

next-netlify-starter-demo

JavaScript
1
star
54

kpop-stack

TypeScript
1
star