#aws-lambda #lambda #run-time #aws #proxy

aws-lambda-runtime-proxy

A helper lib to customize the communication between the lambda handler process and the lambda runtime api

5 unstable releases

0.3.0 Oct 10, 2024
0.2.1 Apr 9, 2024
0.2.0 Apr 9, 2024
0.1.1 Apr 2, 2024
0.1.0 Apr 1, 2024

#2077 in Network programming

Download history 4/week @ 2024-07-27 2/week @ 2024-08-31 8/week @ 2024-09-21 141/week @ 2024-10-05 39/week @ 2024-10-12 4/week @ 2024-10-19 9/week @ 2024-11-02

80 downloads per month
Used in aws-lambda-log-proxy

Custom license

15KB
168 lines

AWS Lambda Runtime Proxy

Crates.io Version license

overview

A helper lib to customize the communication between the lambda handler process and the lambda runtime api.

Documentation

Examples

See the examples folder for more details.

Some real world cases:

FAQ

What's the Purpose of this Project?

  • Override reserved environment variables like AWS_LAMBDA_RUNTIME_API.
  • Capture or modify the output of the handler function, including the stdout, stderr, or the return value.
  • Add additional command line arguments to the handler process.

How Does This Work?

proxy

This library will do the following:

  • Start an HTTP server to act as the fake AWS Lambda runtime API server, accepting requests from the handler process.
  • Spawn the handler process as a child process, with the environment variables modified to point to the fake AWS Lambda runtime API server.
  • (Optional) Forward requests from the handler process to the real AWS Lambda runtime API server.

Based on this setup, you can write your own logic to process the requests and responses between the handler process and the AWS Lambda runtime API.

Performance

See benchmark. TLDR: the proxy will introduce less than 2ms latency, which is acceptable for most use cases.

CHANGELOG

Dependencies

~5–13MB
~150K SLoC