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
- Run
sls deploy
which would give an error about missing file path in the package path. - If you look at .serverless it should have 3 files-
cloudformation-template-create-stack.json cloudformation-template-update-stack.json serverless-state.json
- rename .serverless folder to p
- cargo build --release then add aws-rust-simple-http-endpoint.zip which consists of target/release/test only to the p folder
- 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/.