Adding Layers to AWS Lambda

Jaivardhan Lal
2 min readAug 18, 2020

What is a Lambda layer?
A Lambda Layer is a ZIP archive that contains libraries. Layers are very useful if you have various Lambda functions using the same dependencies since the dependencies will be imported into the Lambda function at runtime.

A function can use up to 5 layers at a time. The total unzipped size of the function and all layers can’t exceed the unzipped deployment package size limit of 250 MB.

To create a new layer say for example boto3. One way is to download and zip the files on your machine.

pip install -target ./python boto3

Now go to AWS Lambda console and under “Additional resources” click on layers.

Click on “Create Layer” button. Give a name to your layer, upload the zip file and then select the runtime your layers are compatible with. You can later create versions of the same layer as well if needed.

You can now add a layer to your function by going to layers and then “Add a Layer” . Select the installed layer and the version you want to use.

--

--