By Selman Karaosmanoglu
8 July 2024
This repository provides a guide for deploying a Rust-based AWS Lambda function on AWS Lambda utilizing Cargo-Lambda Rust library
flowchart LR;
A((HTTPS invoke)) <-.-> B((AWS Lambda λ));
B <--> C[main.rs];
- Memory Efficiency: Rust uses significantly less memory compared to Python. This is because Rust is a compiled language with efficient memory management, while Python is an interpreted language with higher memory overhead.
- Performance: Rust offers substantial performance improvements over Python, often ranging from 10 to 1000 times faster, depending on the task.
- Deployment: Rust enables small binary deployments. By optimizing for size, Rust binaries can be significantly smaller than those of other languages.
- Cost Efficiency: Building on ARM architecture can be up to 34% cheaper, especially with processors like Amazon’s Graviton.
- Energy Efficiency: Rust is highly energy-efficient, often comparable to C, and significantly more efficient than languages like Python.
- Fast Response Times: Rust can achieve very low response times, often as low as 2 milliseconds, due to its efficient execution and low-level control.
If you don't have Rust on your system install rust using https://rustup.rs
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Cargo Lambda simplifies running, building, and deploying Rust functions on AWS Lambda without needing containers or VMs.
brew tap cargo-lambda/cargo-lambda
brew install cargo-lambda
For more information or other installation information on Cargo Lambda: https://www.cargo-lambda.info/guide/getting-started.html
If not, you can install with pip
pip install awscli
aws configure
make watch
make invoke
make build && make deploy
make aws-invoke
- Rust AWS Lambda - O'Reiily