Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

AWS Lambda template for Rust

How to use

Preparation

See cross-rs/cross for installation guide.

In brief:

  1. docker should be prepared.
  2. cargo install cross

Compile

make lambda-build

Create lambda function

Create 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::xxxx

Then,

make lambda-create

Upload / Update function

make lambda-update

Create API Gateway

Refer to akrylysov/algnhsa -> Setting up API Gateway chapter.

If needed, create a Stage for this API.

[0/1] TODOs

Intergrate a “true” HTTP server w/ full router support

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/404use tower::Service;use lambda_http::{Request,ServiceExt};#[derive(Default)]structMyHandler;// vvvvvvvvvvvvvvvv HEREimplService<Request>forMyHandler{// skipped}#[tokio::main]asyncfnmain() -> Result<(),Error>{// Use lambda_http::run to wrap the Service
lambda_http::run(MyHandler::default()).await}

About

Boilerplate for using Rust on Amazon AWS Lambda

Resources

Stars

0 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages