Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/discretetom/aws-lambda-runtime-proxy
A helper lib to customize the communication between the lambda handler process and the lambda runtime api.
https://github.com/discretetom/aws-lambda-runtime-proxy
aws aws-lambda aws-lambda-runtime proxy rust
Last synced: 15 days ago
JSON representation
A helper lib to customize the communication between the lambda handler process and the lambda runtime api.
- Host: GitHub
- URL: https://github.com/discretetom/aws-lambda-runtime-proxy
- Owner: DiscreteTom
- License: mit
- Created: 2024-03-21T10:21:31.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-10T07:31:41.000Z (about 1 month ago)
- Last Synced: 2024-10-10T09:50:07.601Z (about 1 month ago)
- Topics: aws, aws-lambda, aws-lambda-runtime, proxy, rust
- Language: Rust
- Homepage:
- Size: 153 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS Lambda Runtime Proxy
[![Crates.io Version](https://img.shields.io/crates/v/aws-lambda-runtime-proxy?style=flat-square)](https://crates.io/crates/aws-lambda-runtime-proxy)
![license](https://img.shields.io/github/license/DiscreteTom/aws-lambda-runtime-proxy?style=flat-square)![overview](./img/overview.png)
A helper lib to customize the communication between the lambda handler process and the lambda runtime api.
## [Documentation](https://docs.rs/aws-lambda-runtime-proxy/)
## Examples
See the [examples](./examples) folder for more details.
Some real world cases:
- [AWS Lambda Post Runner](https://github.com/aws-samples/aws-lambda-post-runner/)
- [AWS Lambda Log Proxy](https://github.com/DiscreteTom/aws-lambda-log-proxy)## FAQ
### What's the Purpose of this Project?
- Override [reserved environment variables](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime) 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](./img/proxy.png)
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](./benchmark/README.md). TLDR: the proxy will introduce less than 2ms latency, which is acceptable for most use cases.
## [CHANGELOG](./CHANGELOG.md)