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

axum-aws-lambda

Tower Layer for compatibility between Axum and AWS Lambda Runtime

8 releases (breaking)

0.7.0 Mar 29, 2024
0.6.0 Dec 22, 2023
0.5.1 Dec 12, 2023
0.5.0 May 8, 2023
0.1.0 Jun 13, 2022

#530 in Network programming

Download history 2793/week @ 2024-01-25 3730/week @ 2024-02-01 3422/week @ 2024-02-08 3076/week @ 2024-02-15 2940/week @ 2024-02-22 3220/week @ 2024-02-29 2929/week @ 2024-03-07 4249/week @ 2024-03-14 3783/week @ 2024-03-21 3362/week @ 2024-03-28 3727/week @ 2024-04-04 5500/week @ 2024-04-11 4977/week @ 2024-04-18 5139/week @ 2024-04-25 3904/week @ 2024-05-02 1330/week @ 2024-05-09

16,474 downloads per month

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
~417K SLoC