- Automatically attach layers for each lambda function
- Creates a new layer version when
package.json
was updated - If package.json was not changed, it does not publish a new layer
- Reduces drastically lambda size
- It reduces deployment time.
- Share same layers (libraries) with all lambda functions
- Serverless >= 1.34.0 (layers support)
- Node >= v6.10.3
- NPM >= 3.10.10
- AWS only (sorry)
- A valid package.json file
npm install -D serverless-layers
or
serverless plugin install --name serverless-layers
Add the plugin to your serverless.yml
file:
provider:
...
deploymentBucket: #required!
name: "your_bucket"
package:
individually: false
exclude:
- node_modules/**
plugins:
- serverless-layers
custom:
serverless-layers:
packageManager: yarn # NEW
compileDir: .serverless
packagePath: package.json
compatibleRuntimes: ['nodejs']
layersDeploymentBucket: "your_layers_bucket"
customInstallationCommand: 'MY_ENV=foo npm --proxy https://myproxy.com install --production'
Yes, thank you! This plugin is community-driven, most of its features are from different authors. Please update the docs and tests and add your name to the package.json file. We try to follow Airbnb's JavaScript Style Guide.
MIT