Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

This is a very basic AWS Lambda written in Rust. Great for starting off your own project!

Notifications You must be signed in to change notification settings

darrenmeehan/hello-word-rust-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello-word-rust-lambda

A simple AWS Lambda written in Rust.

Test

cargo test

Build

To build the Rust binary

$ cargo build --release

Build on MacOS

$ 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

Deployment

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

Invoke AWS Lambda

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!"}

About

This is a very basic AWS Lambda written in Rust. Great for starting off your own project!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published