All Products
Search
Document Center

:CreateLayerVersion

Last Updated:Sep 09, 2026

Publishes a layer version.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

fc:CreateLayerVersion

create

*LayerVersion

acs:fc:{#regionId}:{#accountId}:layers/{#layerName}/versions/*

None None

Request syntax

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

Path Parameters

Parameter

Type

Required

Description

Example

layerName

string

Yes

The name of the layer. Maximum length: 128 characters.

MyLayer

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The layer information.

description

string

No

The description of the layer. Maximum length: 256 characters.

test

compatibleRuntime

array

No

The list of runtime environments supported by the layer.

string

No

The runtime name. 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

Code Code

Yes

The code of the layer.

X-Fc-Account-Id

string

No

Your Alibaba Cloud account ID.

188077086902****

X-Fc-Date

string

No

The start date when the function is invoked. The format is EEE,d MMM yyyy HH:mm:ss GMT.

Wed, 11 May 2022 09:00:00 GMT

X-Fc-Trace-Id

string

No

The trace ID of the Function Compute invocation request.

r4isu4sls****

Response elements

Element

Type

Description

Example

object

The details of the layer.

layerName

string

The name of the layer.

MyLayer

version

integer

The version of the layer.

1

description

string

The description of the version.

the first layer

code OutputCodeLocation

The code package information of the layer.

codesize

integer

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

421

codeChecksum

string

The CRC-64 checksum of the layer code package, calculated based on the ECMA-182 standard.

2825179536350****

createTime

string

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

2022-01-01T11:08:00Z

acl

integer

The access mode of the layer. A value of 0 indicates private, and a value of 1 indicates public. Official public layers are public by default. Custom layers can be set to private or public.

0

compatibleRuntime

array

The list of runtime environments supported by the layer.

string

The runtime name. 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

arn

string

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

xxxxxxxx#Layer-name#1

Examples

Success response

JSON format

{
  "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

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.