/rust-cli-aws-proj1

A Rust CLI project deployed with AWS

Primary LanguageRustCreative Commons Zero v1.0 UniversalCC0-1.0

A Rust CLI in an AWS Lambda Function.

This project has been moved here.

Goal

  • Build a cli tool with Rust
  • Deploy the project onto AWS by interacting with some cloud service, e.g. S3, Cloud9, Lambda
  • Learn AWS (probably leverage S3, Cloud9 or Lambda) and Rust (mainly Clap in this project) as the project grows.

Development and reproduce

# cargo install cargo-lambda (run if you have never installed it; this cmd can take some time to finish since it's going to compile the binary in your system)
cargo lambda new my-first-lambda-function

# write code..

# rustup target add x86_64-unknown-linux-musl (run if you have never installed it)
cargo build --release --target x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-musl/release/myfirstlambdafunction ./bootstrap
zip lambda.zip bootstrap
# I then use the AWS Lambda console to submit the zip file

Test

Input
{
  "choice": "paper"
}

Output
{
  "req_id": "33a2469e-cd51-4924-8e49-7eb482573454",
  "msg": "You chose: paper, Computer chose: rock, Result: You win!"
}

test-result

References