Skip to content
Kanji Tanaka edited this page Nov 19, 2022 · 1 revision

Sample

serverless.yml samples for some Cargo.toml.

Simple package

If no [ [bin] ] in Cargo.toml

Cargo.toml

[package]
name = "simple-package"
version = "0.1.0"
...

[dependencies]
lambda_runtime = "0.7"
...

then the handler for each function is [package name].

serverless.yml

functions:
  hello:
    handler: simple-package
    ...

Binary name is specified in Cargo.toml

Cargo.toml

[package]
name = "multi-binaries"
version = "0.1.0"
...

[[bin]]
name = hello
path = "src/bin/hello.rs"

[[bin]]
name = world
path = "src/bin/world.rs"

[dependencies]
lambda_runtime = "0.7"
...

then the handler for each function is [package name].[bin name].

serverless.yml

functions:
  hello:
    handler: multi-binaries.hello
    ...

  world:
    handler: multi-binaries.world
    ...

Clone this wiki locally