- Use it at your own risk
- Contributions Accepted
I develop a lot of projects using AWS Lambda, and one of my biggest frustrations is the fact
that it's not possible to Test End-To-End the Lambda call (e.g.: Simulate the real Lambda Call).
Currently, AWS provides a Lambda Runtime Interface Emulator
for testing purposes, but you're required to create a Docker Image and wrap your "executable" into the Container Entrypoint.
The goal of this is to use TestContainers and just start your lambda Handler with AWS_LAMBDA_RUNTIME_API
pointing to this container.
This package is also available as Docker Container.
docker run -p 8080:8080 -d driverpt/aws-lambda-runtime-simulator
Start your handler by setting AWS_LAMBDA_RUNTIME_API
Env Var to localhost:8080
Send invocations
curl -X POST localhost:8080/invocation -d <Invocation Payload>
Will return something like
{
"InvocationId": "<UUID>"
}
Access invocation result with
curl localhost:8080/invocation/<InvocationId>
If you do not want to use Docker Container, go to the Releases Page and download the proper package for your System Arch.
Everything is configured via environment variables
SERVER_PORT=<NewServerPort> # Defaults to 8080
FUNCTION_TIMEOUT=<FunctionTimeoutInSeconds> # Defaults to 120, simulates Timeouts
ARN=<LambdaArn> # AWS Lambda ARN that you want in the HTTP Headers
LOG_LEVEL=<LogLevel> # Log verbosity, defaults to INFO
This only simulates AWS Lambda Runtime API Calls, does not simulate Lambda Interruptions. If you need to simulate interruptions, I strongly recommend using official Lambda Runtime Interface Emulator