#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

#437 in Network programming

Download history 1968/week @ 2024-09-05 2037/week @ 2024-09-12 2018/week @ 2024-09-19 2438/week @ 2024-09-26 3417/week @ 2024-10-03 2126/week @ 2024-10-10 2176/week @ 2024-10-17 2622/week @ 2024-10-24 2317/week @ 2024-10-31 2622/week @ 2024-11-07 2408/week @ 2024-11-14 2927/week @ 2024-11-21 1755/week @ 2024-11-28 2621/week @ 2024-12-05 3222/week @ 2024-12-12 1185/week @ 2024-12-19

9,198 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
~388K SLoC