#aws-lambda #axum #tower #lambda #run-time #aws

axum-aws-lambda

Tower Layer for compatibility between Axum and AWS Lambda Runtime

9 breaking releases

0.10.0 Jan 21, 2025
0.9.0 Oct 8, 2024
0.8.0 Jul 31, 2024
0.7.0 Mar 29, 2024
0.2.0 Jul 26, 2022

#349 in Network programming

Download history 4442/week @ 2025-01-06 1692/week @ 2025-01-13 1337/week @ 2025-01-20 2902/week @ 2025-01-27 3213/week @ 2025-02-03 2179/week @ 2025-02-10 1551/week @ 2025-02-17 1483/week @ 2025-02-24 2647/week @ 2025-03-03 3528/week @ 2025-03-10 2203/week @ 2025-03-17 1262/week @ 2025-03-24 1213/week @ 2025-03-31 1786/week @ 2025-04-07 1242/week @ 2025-04-14 1418/week @ 2025-04-21

5,694 downloads per month
Used in senax

MIT license

16KB
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