All Products
Search
Document Center

Function Compute:CreateLayerVersion

Last Updated:Apr 28, 2025

Releases a layer version.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
fc:CreateLayerVersioncreate
*LayerVersion
acs:fc:{#regionId}:{#accountId}:layers/{#layerName}/versions/*
    none
none

Request syntax

POST /2021-04-06/layers/{layerName}/versions HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
layerNamestringYes

The layer name. The name can be up to 128 character in length.

MyLayer
bodyobjectNo

The information about the layer.

descriptionstringNo

The layer description. The description can be up to 256 characters.

test
compatibleRuntimearrayNo

The runtimes that are supported by the layer.

stringNo

The runtimes. Valid values: nodejs20, nodejs18, nodejs16, nodejs14, nodejs12, nodejs10, nodejs8, nodejs6, python3.10, python3.9, python3, python2.7, java11, java8, php7.2, go1, dotnetcore3.1, dotnetcore2.1, custom.debian10, and custom.

python3
CodeCodeYes

The layer code.

X-Fc-Account-IdstringNo

The ID of your Alibaba Cloud account.

188077086902****
X-Fc-DatestringNo

The time when the function is invoked. The value is in the EEE,d MMM yyyy HH:mm:ss GMT format.

Wed, 11 May 2022 09:00:00 GMT
X-Fc-Trace-IdstringNo

The trace ID of the invocation request of Function Compute.

r4isu4sls****

Response parameters

ParameterTypeDescriptionExample
headersobject
ETagstring

The identifier of the layer version.

xxx
object

The details of the layer.

layerNamestring

The layer name.

MyLayer
versioninteger

The layer version.

1
descriptionstring

The description of the layer version.

the first layer
codeOutputCodeLocation

The information about the layer code package.

codesizelong

The size of the layer code package. Unit: bytes.

421
codeChecksumstring

The CRC-64 value of the layer code package. The value is calculated based on the **ECMA-182 **standard.

2825179536350****
createTimestring

The time when the layer version was created. The time is in the yyyy-MM-ddTHH:mm:ssZ format.

2022-01-01T11:08:00Z
aclinteger

The access mode of the layer. Digit 0 specifies that the layer is private and digit 1 specifies that the layer is public. By default, public layers are public. Custom layers can be set to private or public.

0
compatibleRuntimearray

The runtimes that are supported by the layer.

runtimestring

The runtime. Valid values: nodejs20, nodejs18, nodejs16, nodejs14, nodejs12, nodejs10, nodejs8, nodejs6, python3.10, python3.9, python3, python2.7, java11, java8, php7.2, go1, dotnetcore3.1, dotnetcore2.1, custom.debian10, and custom.

python3
arnstring

The Alibaba Cloud Resource Name (ARN) of the layer.

xxxxxxxx#Layer-name#1

Examples

Sample success responses

JSONformat

{
  "layerName": "MyLayer",
  "version": 1,
  "description": "the first layer",
  "code": {
    "repositoryType": "oss",
    "location": "https://xyz.oss-cnxxx.aliyuncs.com/xxx/xxx/xxx"
  },
  "codesize": 421,
  "codeChecksum": "2825179536350****",
  "createTime": "2022-01-01T11:08:00Z",
  "acl": 0,
  "compatibleRuntime": [
    "python3"
  ],
  "arn": "xxxxxxxx#Layer-name#1"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-12-16The internal configuration of the API is changed, but the call is not affectedView Change Details
2021-06-30The request parameters of the API has changedView Change Details
2021-06-30The request parameters of the API has changedView Change Details
2021-06-30The request parameters of the API has changedView Change Details