This topic describes how to manage layers of functions in the Function Compute console.

Create and use layers

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Layer Management.
  4. In the upper-left corner of the Layer Management page, click Create Layer.
    create-layer
  5. On the Create Layer page, enter the layer name, select the upload method and runtime environment of the code used to create the layer, and then click Create.
    configure-layer The following table describes the parameters.
    Parameter Description
    Layer Name The custom name of the layer.
    Layer Description The description of the layer. Layer descriptions can be used to distinguish between layers.
    Upload Code The method to upload the code.
    Note If you upload the code by using a code package or a folder, the maximum size of the compressed file allowed is 50 MB. If you upload the code from Object Storage Service (OSS), the maximum size of the compressed object allowed is 100 MB.
    Running Environment The runtime environment of the code. Only Python and Node.js are supported.
    After a layer is created, the layer version is automatically generated. The version number starts from 1.
  6. Optional:Create a version.
    1. Click Create Version in the upper-right corner of the Layer Management page.
    2. On the Create Layer page, upload the updated code for the layer, select the runtime environment, and then click Create to create a version for the layer.
  7. Select the layer and version to be loaded when you create or update a function. For more information, see Manage a function.
    In this example, a layer is loaded when you create a function. choose-layer
    Notice You can select a maximum of five layers for a function.

Delete a layer

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Layer Management.
  4. On the Layer Management page, find the layer that you want to delete and click Delete in the Actions column.
    delete-layer
    Notice Before you delete a layer, make sure that the layer is not referenced by a function. Otherwise, function exceptions may occur.