Set up (MacOS)
- Add x86_64 target architecture for Rust
rustup target add x86_64-unknown-linux-musl
- Install cross system C linker
sudo brew install filosottile/musl-cross/musl-cross
- Create .cargo/config and targeting x86_64 architecture for linux
echo $'[target.x86_64-unknown-linux-musl]\nlinker = "x86_64-linux-musl-gcc"' > .cargo/config
Build
- Build the project
cargo build --release --target x86_64-unknown-linux-musl
- Packaging binaries and zipping them into lambda.zip file
cp ./target/x86_64-unknown-linux-musl/release/lambda_rust ./bootstrap && zip lambda.zip bootstrap && rm bootstrap
Deploy
Deployment is manual at the moment
- Sign in to AWS console and navigate to Lambda section
- Create Lambda by choosing custom runtime option
- Deploy the .zip file