How to publish and use AWS Lambda Layers with the Serverless Framework

AWS re:Invent is in full swing, with AWS announcing a slew of new features. Most notably, we’re pretty excited about AWS Lambda’s support for Layers.

Layers allows you to include additional files or data for your functions. This could be binaries such as FFmpeg or ImageMagick, or it could be difficult-to-package dependencies, such as NumPy for Python. These layers are added to your function’s zip file when published. In a way, they are comparable to EC2 AMIs, but for functions.

The killer feature of Lambda’s Layers is that they can be shared between Lambda functions, accounts, and even publicly!

There are two aspects to using Lambda Layers:

  1. Publishing a layer that can be used by other functions
  2. Using a layer in your function when you publish a new function version.

We’re excited to say that the Serverless Framework has day 1 support for both publishing and using Lambda Layers with your functions with Version 1.34.0!

See how you can publish and use Lambda Layers with the Serverless Framework below…

https://serverless.com/blog/publish-aws-lambda-layers-serverless-framework/

Advertisements