Preparation

First, you need to install the Serverless Framework using npm, which is supplied with Node.js:

sudo npm install -g serverless

I installed it globally because I want to use it to create a new project from a Rust template of an application with multiple lambdas:

sls install --url https://github.com/softprops/serverless-aws-rust-multi --name rust-sls

This command downloads the template automatically and will use the name provided to construct a blank application. It prints the following to the console:

Serverless: Downloading and installing "serverless-aws-rust-multi"...
Serverless: Successfully installed "rust-sls"

When the project is initialized, enter a folder of this project and add the serverless-finch plugin, which we will use to upload the assets of our application:

npm install --save serverless-finch

The serverless-aws-rust-multi template is a workspace and contains two crates: hello and world. Let's rename them lambda_1 and lambda_2. I have used this template to show you how an application can include more than one crate. After renaming the folders, we also have to replace the members of a workspace in the Cargo.toml configuration of the project:

[workspace]
members = [
"lambda_1",
"lambda_2",
]

Now we can leave lambda_2 without changes and implement the functionality of the Wild Rydes example in the lambda_1 crate.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.224.226