A simple AWS Lambda written in Rust.
cargo test
To build the Rust binary
$ cargo build --release
$ cargo build --release --target x86_64-unknown-linux-musl
To build the AWS Lambda zip file
$ cp ./target/x86_64-unknown-linux-musl/release/register-on-upload ./bootstrap && zip lambda.zip bootstrap && rm bootstrap
Create AWS Lambda for the first time
$ aws lambda create-function --function-name registerOnUpload \
--handler not.used.in.rust \
--zip-file fileb://./lambda.zip \
--runtime provided \
--role arn:aws:iam::XXXXXXXXXXXXX:role/your_lambda_execution_role \
--environment Variables={RUST_BACKTRACE=1} \
--tracing-config Mode=Active
To update the code of an existing AWS Lambda
$ aws lambda update-function-code --function-name registerOnUpload \
--zip-file fileb://./lambda.zip
To test your deployed AWS Lambda works correctly
$ aws lambda invoke --function-name registerOnUpload \
--cli-binary-format raw-in-base64-out \
--payload '{"firstName": "world"}' \
output.json
$ cat output.json # Prints: {"message":"Hello, world!"}