Skip to content

Cargo lambda

cargo-lambda - Run, Build, and Deploy Rust functions on AWS Lambda natively from your computer, no containers or VMs required.

Install

sh
brew tap cargo-lambda/cargo-lambda
brew install cargo-lambda

Create a new project

sh
cargo lambda new test-function \
&& cd test-function

Build it for AWS lambda

sh
cargo lambda build --release --arm64

Deploy it, make sure to configure AWS credentials using aws cli.

sh
cargo lambda deploy --enable-function-url

You should see an output after success, like this

Output

function arn: arn:aws:lambda:<region>:<aws-user>:function:test-function🔗 function url: https://<url>.lambda-url.<region>.on.aws/

Check the deployed lambda from the success output

sh
curl -X GET "https://<url>.lambda-url.<region>.on.aws/"

To run locally, it will start localhost on 9000

sh
cargo lambda watch