Skip to content

ipetrovbg/lambda-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Set up (MacOS)

  1. Add x86_64 target architecture for Rust
rustup target add x86_64-unknown-linux-musl
  1. Install cross system C linker
sudo brew install filosottile/musl-cross/musl-cross
  1. Create .cargo/config and target x86_64 architecture for linux
echo $'[target.x86_64-unknown-linux-musl]\nlinker = "x86_64-linux-musl-gcc"' > .cargo/config

Build

  1. Build the project with the target
TARGET_CC=x86_64-linux-musl-gcc \ RUSTFLAGS="-C linker=x86_64-linux-musl-gcc" \ cargo build --release --target x86_64-unknown-linux-musl
  1. 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

  1. Sign in to AWS console and navigate to Lambda section
  2. Create Lambda by choosing custom runtime option
  3. Deploy the .zip file

Lambda test event

{
  "message": "Hello from Rust"
}

About

AWS Lambda with Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages