Running Rust natively in AWS Lambda and testing it locally

This project [rust-aws-lambda] forgoes embedding and instead leverages lambda’s official Go support. (…) Lambda does not care that the Linux binary it runs is written in Rust rather than Go as long as they behave the same.


$ rustup target add x86_64-unknown-linux-musl

Hello, World!

AWS Lambda “Hello World” in Rust


Expected result

Program Flow

"body": "<base64-encoded-image>"
Decode image and store it in a `DynamicImage`
Create 128x128 thumbnail
Encode as PNG, and then as base64
Create and return the response

Testing locally

Photo used to testing
"body": "<base64-encoded-image>"
Result of running the above command
128x128 thumbnail

Uploading to AWS

Lambda Function creation
Function test event
Our function working!




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store