# Lambda Layers

A Lambda Layer is a Zip archive that can contain additional code or other content. A Lambda Layer may contain libraries, a custom runtime, data, or configuration files.

Lambda Layers provide a convenient and effective way to package code libraries for sharing with Lambda functions in your account. Using layers can help reduce the size of uploaded archives and make it faster to deploy your code.

## Enabling Lambda Layer creation

You must add a Key/Value pair in the DuploCloud Portal's **System Config** settings to display Lambda Layers in DuploCloud.

1. In the DuploCloud Portal, navigate to **Administrator** -> **System Settings**.
2. Click the **System Config** tab.
3. Click **Add**. The **Add Config** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FFJqJqxVojFQzBP7QWCbn%2FL5.png?alt=media&#x26;token=6069c0cc-64d4-4e51-8f6b-c754095ad580" alt=""><figcaption><p><strong>Add Config</strong> pane</p></figcaption></figure></div>
4. From the **Config Type** list box, select **Other**. The **Other Config Type** field displays.
5. In the **Other Config Type** field, select **AppConfig**.
6. In the **Key** field, enter `ListAllLambdaLayers`.
7. In the **Value** field, enter `true`.
8. Click **Submit**. The **Key**/**Value** pair is displayed in the **System Config** tab.

<div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FhxGc5RyeNb8TgY4ndqFa%2FL4.png?alt=media&#x26;token=a8eb652f-f428-40cf-9726-d01f42a6c088" alt=""><figcaption><p><strong>System Settings</strong> with <strong>ListAllLambdaLayers AppConfig Type</strong> set to <strong>Value</strong> of <strong>True</strong></p></figcaption></figure></div>

After you set `ListAllLambdaLayers` to `true`:

* Layer names prefixed with `duplo-` display for all Tenants in the DuploCloud Portal.
* Layer names prefixed with `duploservices-TENANT_NAME` display in the `TENANT_NAME` Tenant.

## Creating Lambda Layers

Follow the [AWS instructions to create layers](https://docs.aws.amazon.com/lambda/latest/dg/creating-deleting-layers.html#layers-create).

## Adding Lambda Layers to a Lambda Function

You can add layers to a new or existing [Lambda Function](https://docs.duplocloud.com/docs/automation-platform/overview/aws-services/lambda). For example, to add a layer to an existing function:

1. In the DuploCloud Portal, navigate to C**loud Services** -> **Serverless**.
2. In the **Lambda** tab, select the Lambda Function to which you want to add Lambda Layers.
3. Click the **Actions** menu and select **Edit**. The **Edit Lambda Function** page displays.
4. In the **Layers** area, click the + button. The **Add Lambda Layer** pane displays.\ <br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FYYtP7WfwWzfGGYxY12Xe%2Flam_eph5.png?alt=media&#x26;token=26daa40c-eef2-4876-a625-402ee43528c4" alt=""><figcaption><p>Lambda Layers area with add (<strong>+</strong>) and <strong>Delete</strong> options<br><br></p></figcaption></figure></div>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FQGZ7ZWa8LTMrQjUT5Nit%2Flam_eph6.png?alt=media&#x26;token=65cb1cab-df60-464f-b4dc-9cf27672fdfc" alt=""><figcaption><p><strong>Add a Lambda Layer</strong> pane<br></p></figcaption></figure></div>
5. From the **Layer** list box, select the Lambda Layer to add.
6. From the **Version** list box, select the layer version.
7. Click **Add Layer**. The layer you added is displayed in the **Layers** area of the **Edit Lambda Function** page.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.duplocloud.com/docs/automation-platform/overview/aws-services/lambda/lambda-layers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
