AWS Lambda Runtime API for local testing of custom runtimes
This project runs an HTTP API that is intended to emulate the AWS Lambda Runtime Interface to enable local testing of custom runtimes.
This utility is published as both a jar or Docker image.
Prerequisites:
- JRE/JDK 11
Grab the latest release and run:
java -jar aws-lambda-runtime-local-<version>.jarRun on alternate port
java -jar -Druntime.port=8080 aws-lambda-runtime-local-<version>.jarDockerhub Link: https://hub.docker.com/r/c1phr/aws-lambda-runtime-local
docker run -p 9000:9000 c1phr/aws-lambda-runtime-localRun on alternate port
docker run -p 8080:8080 -e RUNTIME_PORT=8080 c1phr/aws-lambda-runtime-localThis utility will expose endpoints that mirror the AWS Lambda Runtime interface:
GET http://localhost:9000/2018-06-01/runtime/invocation/next
POST http://localhost:9000/2018-06-01/runtime/invocation/$REQUEST_ID/response
POST http://localhost:9000/2018-06-01/runtime/invocation/$REQUEST_ID/error
POST http://localhost:9000/2018-06-01/runtime/init/error
In addition to an endpoint that allows you to stage request events for your runtime to invoke:
POST http://localhost:9000/event/next
The runtime will serve events that have been POSTed to the /event/next endpoint sequentially each time the /invocation/next endpoint is called (or will return an empty response when there is no pending event).
Invocation requests will include headers to emulate the Lambda Runtime interface as well, and expects that Request IDs are included with calls to /response and /error just as the Lambda service would.
The following configuration options can be set to modify the behavior of the local runtime. Either JVM arguments or environment variables can be used depending on the environment (JVM vs Docker).
| Effect | JVM Argument | Environment Variable |
|---|---|---|
| Set Runtime Port | runtime.port=8080 | RUNTIME_PORT=8080 |
| Enable Request/Response Debugging | runtime.debug=true | RUNTIME_DEBUG=true |