AWS Serverless Boilerplate example in Rust

This example shows a Serverless boilerplate in Rust.

Serverless Boilerplate - AWS - Rust

Make sure serverless is installed. See installation guide.

You will also need to set up your AWS account credentials using environment variables or a configuration file. Please see the this guide for more information.

1. Install Project Dependencies

npm install in this directory to download the modules from package.json.

2. Compile Rust Binary

$ cargo build --release

3. Deploy

Hackish way to deploy

  1. Run sls deploy which would give an error about missing file path in the package path.
  2. If you look at .serverless it should have 3 files-

cloudformation-template-create-stack.json cloudformation-template-update-stack.json serverless-state.json

  1. rename .serverless folder to p
  2. cargo build --release then add aws-rust-simple-http-endpoint.zip which consists of target/release/test only to the p folder
  3. sls deploy --package p

4. Invoke deployed function

$ curl https://***.execute-api.us-east-1.amazonaws.com/test/test
{"message":"Serverless Rust Hello"}

For more information on the Serverless AWS plugin, please see the project repository: https://serverless.com/framework/docs/providers/AWS/guide/credentials/.