danielsan / serverless-docker-rust

A working Serverless Framework w/ Rust container.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust on Serverless Framework through Docker 🦀🐳

This is a working project to deploy Rust Serverless through Docker using Serverless Framework. We use cargo-lambda for local development and Serverless framework to deploy on AWS.

A working example is available in the hello folder, which is a simple hello world function taken from aws-lambda-rust-runtime. We need to add lambda_http and lambda_runtime crates to get it work with Api Gateway.

You can see that function live here.

Why use docker? Because it's the only way to get a working environment for Rust on Serverless Framework, all the other packages are outdated and not working, happy to be wrong on this.

AWS architecture is arm64 and Docker image builds linux/arm64 as well.

Local deployment

To deploy locally, you need to install Docker and cargo-lambda, then run the following commands:

cd hello 
cargo lambda watch -a 127.0.0.1 -p 8000

Deploy

We suggest to deploy with --verbose flag to see the output of the deployment.

serverless deploy --verbose

About

A working Serverless Framework w/ Rust container.


Languages

Language:Rust 76.8%Language:Dockerfile 23.2%