See cross-rs/cross for installation guide.
In brief:
dockershould be prepared.cargo install cross
make lambda-buildCreate a file named `lambda.mk` with these content:
# Modify with your choice.
function-name=my_function_name
# Create a role for this function runtime on AWS beforehead.
function-role=arn:aws:iam::xxxxThen,
make lambda-createmake lambda-updateRefer to akrylysov/algnhsa -> Setting up API Gateway chapter.
If needed, create a Stage for this API.
Since master branch of lambda_http::Request implements
tower::Service trait, we should use something like this to
dramatically decrease complexity of current code.
// Copied from https://github.com/awslabs/aws-lambda-rust-runtime/issues/404
use tower::Service;
use lambda_http::{Request, ServiceExt};
#[derive(Default)]
struct MyHandler;
// vvvvvvvvvvvvvvvv HERE
impl Service<Request> for MyHandler {
// skipped
}
#[tokio::main]
async fn main() -> Result<(), Error> {
// Use lambda_http::run to wrap the Service
lambda_http::run(MyHandler::default()).await
}