Parameter | Type | Description | Example |
---|---|---|---|
object | The request parameters for creating the function. | ||
handler | string | The handler of the function. The format of the handler is related to the runtime you use. | index.handler |
code | InputCodeLocation | The code package of the function. Configure either code or customContainerConfig. | |
role | string | The Resource Access Management (RAM) role that is assigned to the function. Function Compute assumes the role to obtain a Security Token Service (STS) token, which serves as a temporary key for your function to access other Alibaba Cloud services, such as Object Storage Service (OSS) and Tablestore. | acs:ram::188077086902****:role/fc-test |
tracingConfig | TracingConfig | The configurations of Managed Service for OpenTelemetry. After Function Compute is integrated with Managed Service for OpenTelemetry, you can record the invocation duration of a request, view the cold start duration of a function, and track the execution duration of the function. | |
nasConfig | NASConfig | The File Storage NAS (NAS) configurations. The configurations allow the function to access the specified NAS file system. | |
description | string | The description of the function. | my function |
timeout | integer | The timeout period for function execution. Unit: seconds. Default value: 3. Valid values: 1 to 86400. The execution of the function is terminated when the timeout period expires. | 60 |
diskSize | integer | The disk size of the function. Unit: MB. Valid values: 512 and 10240. | 512 |
internetAccess | boolean | Specifies whether to allow the function to access the Internet. Default value: true. | true |
layers | array | The layers. Multiple layers are merged based on the order of array subscripts. If two layers have the same file name, the content of the layer with the smaller subscript will overwrite the content of the layer with the larger subscript. | |
string | The Alibaba Cloud Resource Name (ARN) of the layer. | acs:fc:cn-beijing:186824xxxxxx:layers/fc_layer/versions/1 | |
ossMountConfig | OSSMountConfig | The OSS mounting configurations. | |
customRuntimeConfig | CustomRuntimeConfig | The configurations of the custom runtime. | |
logConfig | LogConfig | The logging configurations. Logs generated by the function are written to the specified Logstore. | |
functionName | string | The name of the function. The name must be 1 to 64 characters in length, and can contain only letters, digits, underscores (_), and hyphens (-). It cannot begin with a digit or a hyphen (-). | my-function-1 |
instanceLifecycleConfig | InstanceLifecycleConfig | The configurations of instance lifecycle hooks. | |
gpuConfig | GPUConfig | The GPU configurations of the function. | |
cpu | float | The CPU power allocated to the function. Unit: vCPUs. The value must be a multiple of 0.05. The minimum value is 0.05 and the maximum value is 16. The ratio of cpu to memorySize (in GB) must be from 1:1 to 1:4. | 1 |
runtime | string | The runtime of the function. Valid values: nodejs8, nodejs10, nodejs12, nodejs14, nodejs16, nodejs18, nodejs20, go1, python3, python3.9, python3.10, java8, java11, php7.2, dotnetcore3.1, custom, custom.debian10, and custom-container. | python3.10 |
customContainerConfig | CustomContainerConfig | The configurations of the Custom Container runtime. After you configure a Custom Container runtime for your function, Function Compute can execute the function in a custom container image. Configure either code or customContainerConfig. | |
instanceConcurrency | integer | The maximum number of requests that a function instance can process at a time. | 1 |
tags | array | The tags. | |
Tag | The tag information. | ||
memorySize | integer | The memory capacity for the function. Unit: MB. The value must be a multiple of 64. The minimum capacity is 128 MB and the maximum capacity is 32 GB. The ratio of cpu to memorySize (in GB) must be from 1:1 to 1:4. | 512 |
customDNS | CustomDNS | The custom DNS settings of the function. | |
environmentVariables | object | The environment variables of the function. You can access the specified environment variables in the runtime. | |
string | The value of the environment variable. | value1 | |
vpcConfig | VPCConfig | The Virtual Private Cloud (VPC) configurations. The configurations allow the function to access the specified VPC resources. |