- Notifications
You must be signed in to change notification settings - Fork11
An OCaml custom runtime for AWS Lambda and Vercel
License
anmonteiro/aws-lambda-ocaml-runtime
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This package provides acustomruntime forAWS Lambda.
This repository provides two libraries:
lambda-runtimeprovides a runtime and API forAWS Lambda andAPI Gateway.- the
vercellibrary depends onlambda-runtimeand provides an interface totheVercel service that resembles a request / responseexchange.
The libraries in this repo are released to the OPAM package registry.
You can depend on them via:
- esy:
esy add @opam/lambda-runtimeand / oresy add @opam/vercel - OPAM:
opam install lambda-runtime vercel.
See theexamples folder.
Note: Based on the instructions in thisblogpost andthe Rust custom runtimerepository
For a custom runtime, AWS Lambda looks for an executable calledbootstrap inthe deployment package zip. Rename the generatedbasic executable tobootstrap and add it to a zip archive.
The Dockerfile (in conjunction with thebuild.sh script) in thisrepo does just that. It builds a static binary calledbootstrap and drops itin the target directory.
$ ./build.sh&& zip -j ocaml.zip bootstrapNow that we have a deployment package (ocaml.zip), we can use theAWSCLI to create a new Lambda function. Make sure toreplace 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 (seeLICENSE).
About
An OCaml custom runtime for AWS Lambda and Vercel
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.