This topic describes how to configure custom layers for a function.
Use the Function Compute console
Before you start
Procedure
When you configure a layer for a function, one version of the layer is bound to the function based on your business requirements if the layer has multiple versions.
- Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.
- In the top navigation bar, select a region. On the Services page, click the desired service.
- On the Functions page, find the desired function and click Configure in the Actions column.
- In the Layers section, click + Add Layer and select Add Custom Layer from the drop-down list. Select options from the Custom Layer and Layer Version drop-down lists, and then click Save.
Note
- A function can be configured with a maximum of five layers, including custom layers and official public layers.
- When multiple layers are configured for a function, the content of these layers is merged and stored in the /opt directory in reverse order. If layers contain files with the same name, the files in the first configured layer overwrites the files with the same names in the later configured layer.
Use Serverless Devs
Prerequisites
Procedure
Additional information
You can also use API operations or SDKs to manage and configure layers. You can configure
layers by calling the following API operations:
You can use OpenAPI Explorer to call API operations and use SDKs.