0.2.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
AGPL-3.0-only - GNU Affero General Public License v3.0 onlyHelper libraries for running/testing Actix servers under AWS Lambda
Currently, it just consists of a simple helper function run
that will run the entire app as a lambda function, and lambda_test
which will feed in a single Application Load Balancer event into the Lambda app.
use actix_web::{http::Method, HttpRequest, HttpResponse, web};
fn root_handler(request: HttpRequest) -> HttpResponse {
return HttpResponse::Ok().body("Hello world");
}
fn config(cfg: &mut web::ServiceConfig) {
cfg.route("/", web::get().to(root_handler));
// More route handlers
}
fn main() {
actix_lambda::run(config);
}
#[test]
fn lambda_test() {
actix_lambda::test::lambda_test(main);
}
In addition to the Rust code, there's also some Python work with CloudFormation and Troposphere to enable building stacks with this. To deploy this do the following:
rustup target add x86_64-unknown-linux-musl
brew install filosottile/musl-cross/musl-cross
(or do Linux-equivalent steps to get a Musl cross-compiler)mkdir .cargo && echo '[target.x86_64-unknown-linux-musl]\nlinker = "x86_64-linux-musl-gcc"' > .cargo/config
cargo build --release --target x86_64-unknown-linux-musl
pip install -r requirements.txt
python cf.py <path to your app's root>
You should now be able to run your app from the URL that the script spat out.