AWS announced two new AWS Lambda features, Lambda Runtime API and Lambda Layers, on Nov 29, 2018. These features enables developers to build common code, manage it and share it between multiple functions.
A Layer is a zip archive which contains libraries and dependencies which can be imported to Lambda functions at runtime. They also support versioning which makes it possible to upgrade the Lambda layer with new code without impacting the Lambda functions using it. Lambda Layers provide two major benefits as below…
- If there are more than one Lambda function have same dependencies, those dependencies can be uploaded as a Layer and used across Lambda functions.
- The deployment package size of the Lambda package is reduced as the dependencies are no more required to be part of the deployment package.