AWS Lambda Extensions are sidecar services that can provide extra capabilities to your functions.
Cargo Lambda can also help you build and deploy Lambda Extensions.
To start a new extension project, use with new subcommand with the --extension flag:
cargo lambda new --extension extension-project::: tip
Add the --logs flag if your extension in a Logs extension, or the --telemetry flag if you want to process Lambda telemetry data.
:::
Once you're ready to compile your project, use the build subcommand with the --extension flag:
cargo lambda build --extensionLambda extensions are deployed as layers for functions to consume. Use the deploy subcommand with the --extension flag to upload the extension layer to AWS. When this command completes, it will print the full ARN to use to attach this extension to a function:
cargo lambda deploy --extensionIf you already have a function project that you want to attach your extension to, you can use the same deploy subcommand to do so. Go to the root directory for your function's project, and add the --layer-arn flag with the extension ARN that the previous command printed in the terminal:
cargo lambda deploy --layer-arn EXTENSION_ARN