#aws-lambda #tower-layer #axum #lambda #aws #tower

axum-aws-lambda

Tower Layer for compatibility between Axum and AWS Lambda Runtime

8 breaking releases

0.9.0 Oct 8, 2024
0.8.0 Jul 31, 2024
0.7.0 Mar 29, 2024
0.6.0 Dec 22, 2023
0.2.0 Jul 26, 2022

#376 in Network programming

Download history 2389/week @ 2024-08-21 3246/week @ 2024-08-28 2306/week @ 2024-09-04 1735/week @ 2024-09-11 2018/week @ 2024-09-18 2352/week @ 2024-09-25 3284/week @ 2024-10-02 2373/week @ 2024-10-09 2203/week @ 2024-10-16 2004/week @ 2024-10-23 3031/week @ 2024-10-30 2514/week @ 2024-11-06 2076/week @ 2024-11-13 3310/week @ 2024-11-20 1945/week @ 2024-11-27 1633/week @ 2024-12-04

9,658 downloads per month
Used in senax

MIT license

15KB
115 lines

axum-aws-lambda

Rust crates.io

This crate provides a tower::Layer that translates hyper/axum requests to the format used by the aws-lambda-rust-runtime crate. This allows users to switch between just running a Hyper server, and running under the Lambda runtime - this dramatically speeds up development! It also means that you can use off-the-shelf components from the Tower ecosystem!

Check out examples/main.rs: running in debug mode runs a hyper server, and building for release mode compiles using the Lambda runtime.

Testing out the Lambda runtime locally

There is an example Dockerfile for locally spinning up a lambda runtime:

cargo build --release --example main
docker build . -t lambda-test
docker run -p 9000:8080 lambda-test

In test-lambda-runtime/ there is a python script for testing and a Dockerfile for running it.

In another shell, from the root of this repository:

cd test-lambda-runtime
docker build . -t test_lambda_runtime
docker run --network="host" test_lambda_runtime

Dependencies

~13–23MB
~387K SLoC