ALIYUN::FC::Layer is used to publish layer versions.

For more information about layers and versions, see Manage layers.

Syntax

{
  "Type": "ALIYUN::FC::Layer",
  "Properties": {
    "CompatibleRuntime": List,
    "Description": String,
    "LayerName": String,
    "Code": Map
  }
}

Properties

Property Type Required Editable Description Constraint
CompatibleRuntime List Yes No The runtime environment supported by the layer. Valid values:
  • nodejs12
  • nodejs10
  • nodejs8
  • nodejs6
  • python3
  • python2.7
Description String No No The description of the layer. None
LayerName String Yes No The name of the layer. The name must be 1 to 64 characters in length.
Code Map Yes No The code ZIP package. For more information, see Code syntax and Code properties.

Code syntax

"Code": {
  "ZipFile": String,
  "OssObjectName": String,
  "OssBucketName": String
}

Code properties

Property Type Required Editable Description Constraint
ZipFile String No No The function code that is encoded in Base64. The priority of ZipFile is higher than the priorities of OssBucketName and OssObjectName. Code uses the value of ZipFile first.
OssObjectName String No No The name of the Object Storage Service (OSS) object that stores the ZIP package of the function code. Both OssBucketName and OssObjectName must be configured.
OssBucketName String No No The name of the OSS bucket that stores the ZIP package of the function code. Both OssBucketName and OssObjectName must be configured.

Response parameters

Fn::GetAtt

  • LayerName: the name of the layer.
  • Version: the version of the layer.
  • Arn: the Alibaba Cloud Resource Name (ARN) of the layer resource.

Examples

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "CompatibleRuntime": {
      "Type": "Json",
      "Description": "The runtime environment supported by the layer. For example:nodejs12, nodejs10, nodejs8, nodejs6, python3, and python2.7",
      "MinLength": 1,
      "Default": "[\n  \"python3\"\n]"
    },
    "Description": {
      "Type": "String",
      "Description": "The description of the layer.",
      "Default": "test123"
    },
    "LayerName": {
      "Type": "String",
      "Description": "The name of layer",
      "AllowedPattern": "[a-zA-Z][_a-zA-Z0-9-]+",
      "MinLength": 1,
      "MaxLength": 64,
      "Default": "test123"
    },
    "Code": {
      "Type": "Json",
      "Description": "The code of layer.",
      "Default": "{\n  \"OssBucketName\": \"you_bucket_name\",\n  \"OssObjectName\": \"index.py\"\n}"
    }
  },
  "Resources": {
    "Layer": {
      "Type": "ALIYUN::FC::Layer",
      "Properties": {
        "CompatibleRuntime": {
          "Ref": "CompatibleRuntime"
        },
        "Description": {
          "Ref": "Description"
        },
        "LayerName": {
          "Ref": "LayerName"
        },
        "Code": {
          "Ref": "Code"
        }
      }
    }
  },
  "Outputs": {
    "LayerName": {
      "Description": "The name of layer",
      "Value": {
        "Fn::GetAtt": [
          "Layer",
          "LayerName"
        ]
      }
    },
    "Version": {
      "Description": "The version of the layer resource.",
      "Value": {
        "Fn::GetAtt": [
          "Layer",
          "Version"
        ]
      }
    },
    "Arn": {
      "Description": "The name of the layer resource.",
      "Value": {
        "Fn::GetAtt": [
          "Layer",
          "Arn"
        ]
      }
    }
  }
}