package lambda-runtime

Not available on OCaml 5.5
  1. Overview
  2. Docs
A custom runtime for AWS Lambda written in OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

lambda-runtime-0.1.0.tbz
sha256=58863594a2f94993208c749b77eb769cf5340b8d87bb9e5e994035ba331867ff
sha512=53c9e2c256f092c09e6ce7926b1bbcbdc93efcb727d5a755557d2eb7ab1c7b0ad0a3b8e708b01a70a6eda5ef6fa9714b40f79e172bc5d17aa2c434d8ecb9a9ca

Description

lambda-runtime is a runtime for AWS Lambda that makes it easy to run AWS Lambda Functions written in OCaml.

Added to opam-repository:

README

OCaml Runtime for AWS Lambda

This package provides a custom runtime for AWS Lambda.

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 © 2018 António Nuno Monteiro

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

Dependencies (9)

  1. lwt
  2. logs != "0.8.0"
  3. uri
  4. piaf < "0.2.0"
  5. ppx_deriving_yojson
  6. yojson >= "1.6.0" & < "2.0.0"
  7. result
  8. dune >= "1.7"
  9. ocaml >= "4.08"

Dev Dependencies (1)

  1. alcotest with-test

Optional Dependencies

None

Used by (1)

  1. vercel

Conflicts

None

Build status

Results of building lambda-runtime with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.1.0 (this version) good good n/a n/a n/a
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure