package vercel

  1. Overview
  2. Docs
A custom runtime for (Now v2) written in OCaml


Dune Dependency





OCaml Runtime for AWS Lambda

This package provides a custom runtime for AWS Lambda.

Example function

See the examples folder.


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 script) in this repo does just that. It builds a static binary called bootstrap and drops it in the target directory.

$ ./ && zip -j bootstrap

Now that we have a deployment package (, 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://./ \
  --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"}' \
$ cat output.json  # Prints: {"message":"Hello, world!"}

Copyright & License

Copyright © 2018 António Nuno Monteiro

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


Innovation. Community. Security.