# 03\_LambdaLayers

## Lambda Layers

### Custom Runtimes

* Through lambda layers once can support runtimes that are not supported by AWS.
* Allows languages that are not officially supported by AWS to be used to develop and deploy on Lambda.
* C++ rutimes is one such example. Some of the common ones can be found [here](https://github.com/orgs/awslabs/repositories?q=lambda-runtime).

## Externalize Dependencies

* Dependencies which we use in our lambda code may not change often compare to our application/lambda code. So in order to avoid reuploading dependencies which seldom changes, one can leverage the lambda layers.
* As layers are externalized they can be reused across multiple function code.

### Lambda Layers

* Additional libraries may be bundled and moved as a layer.
* Lambda can have upto 5 layers per function, with maximum deployment size limit of 50 MB/layer.
* One can create a lambda layer and publish it, if required lambda layer is not available.
* The packages added in layers are available in `/opt` directory during invocations.
* Native libraries should be first compiled in Amazon Linux.
* AWS SDK comes by default with every lambda function.

### References

* Using [Lambda Layers](https://aws.amazon.com/blogs/compute/using-lambda-layers-to-simplify-your-development-process/)
