|
Parameter |
Type |
Description |
Example |
|---|---|---|---|
|
object |
The function creation request parameters. |
||
| code | InputCodeLocation |
The ZIP package of the function code. Specify either code or customContainerConfig. |
|
| cpu |
number |
The CPU specification of the function in vCPU. The value must be a multiple of 0.05 vCPU. The minimum value is 0.05 and the maximum value is 16. The ratio of cpu to memorySize (in GB) must be between 1:1 and 1:4. |
1 |
| customContainerConfig | CustomContainerConfig |
The configuration of the custom container runtime. After successful configuration, the function can use a custom container image to execute the function. Specify either code or customContainerConfig. |
|
| customDNS | CustomDNS |
The custom DNS configuration. |
|
| customRuntimeConfig | CustomRuntimeConfig |
The custom runtime configuration. |
|
| description |
string |
The description of the function. |
my function |
| diskSize |
integer |
The disk specification of the function in MB. Valid values: 512 and 10240. |
512 |
| environmentVariables |
object |
The environment variables of the function. You can access the configured environment variables in the runtime environment. |
|
|
string |
The value of the environment variable. |
value1 |
|
| functionName |
string |
The name of the function. The name can contain only letters, digits, underscores (_), and hyphens (-). It cannot start with a digit or hyphen (-). The name must be 1 to 64 characters in length. |
my-function-1 |
| gpuConfig | GPUConfig |
The GPU configuration of the function. |
|
| handler |
string |
The function entry point. The specific format is related to the runtime. |
index.handler |
| instanceConcurrency |
integer |
The maximum concurrency of an instance. |
1 |
| instanceLifecycleConfig | InstanceLifecycleConfig |
The instance lifecycle hook method configuration. |
|
| internetAccess |
boolean |
Specifies whether the function can access the Internet. Default value: true. |
true |
| layers |
array |
The list of layers. Multiple layers are merged in descending order of array index. Content from a layer with a smaller index overwrites files with the same name from a layer with a larger index. |
|
|
string |
The ARN of the layer. |
acs:fc:cn-beijing:186824xxxxxx:layers/fc_layer/versions/1 |
|
| logConfig | LogConfig |
The log configuration. Logs generated by the function are written to the configured Logstore. |
|
| memorySize |
integer |
The memory specification of the function in MB. The value must be a multiple of 64 MB. The minimum value is 128 MB and the maximum value is 32 GB. The ratio of cpu to memorySize (in GB) must be between 1:1 and 1:4. |
512 |
| nasConfig | NASConfig |
The NAS configuration. After you configure this parameter, the function can access the specified NAS resources. |
|
| ossMountConfig | OSSMountConfig |
The OSS mount configuration. |
|
| role |
string |
The RAM role that you grant to Function Compute. After the role is configured, Function Compute assumes this role to generate temporary access credentials. You can use the temporary access credentials of this role in the function to access specified Alibaba Cloud services such as OSS and OTS. |
acs:ram::188077086902****:role/fc-test |
| runtime |
string |
The runtime environment of the function. Currently supported runtime environments include: nodejs12, nodejs14, nodejs16, nodejs18, nodejs20, go1, python3, python3.9, python3.10, python3.12, java8, java11, php7.2, dotnetcore3.1, custom, custom.debian10, custom.debian11, custom.debian12, and custom-container. |
python3.10 |
| timeout |
integer |
The timeout period for function execution in seconds. The minimum value is 1, the maximum value is 86400, and the default value is 3. The function is terminated if it exceeds this time limit. |
60 |
| tracingConfig | TracingConfig |
The tracing configuration. After Function Compute is integrated with Tracing Analysis, you can record the time consumed by requests in Function Compute, view the cold start time of functions, and record the time consumed by internal operations of functions. |
|
| vpcConfig | VPCConfig |
The VPC configuration. After you configure this parameter, the function can access the specified VPC resources. |
|
| tags |
array |
The list of tags. |
|
| Tag |
The tag information. |
||
| disableOndemand |
boolean |
Specifies whether to disable the creation of on-demand instances. After this feature is enabled, on-demand instances are not created and only provisioned instances can be used. |
|
| sessionAffinity |
string |
The session affinity policy for Function Compute invocation requests. To implement request affinity for the MCP SSE protocol, set this parameter to MCP_SSE. To use cookie-based affinity, set this parameter to GENERATED_COOKIE. To use header-based affinity, set this parameter to HEADER_FIELD. If this parameter is not set or is set to NONE, no affinity is applied and requests are routed based on the default scheduling policy of Function Compute. |
MCP_SSE |
| enableLongLiving |
boolean |
Specifies whether to allow provisioned instances of GPU functions to be long-running. When this feature is enabled, function instances that are created are not injected with STS tokens. |
|
| resourceGroupId |
string |
||
| instanceIsolationMode |
string |
The instance isolation mode. |
|
| sessionAffinityConfig |
string |
The session affinity configuration that corresponds to the sessionAffinity type. For MCP_SSE affinity, configure MCPSSESessionAffinityConfig. For cookie-based affinity, configure CookieSessionAffinityConfig. For header field affinity, configure HeaderFieldSessionAffinityConfig. |
{\"sseEndpointPath\":\"/sse\", \"sessionConcurrencyPerInstance\":20} |
| idleTimeout |
integer |
The instance deferred release time. |
100 |
| disableInjectCredentials |
string |
Specifies whether to disable STS token injection. Valid values:
|
Env |
| polarFsConfig | PolarFsConfig |
The PolarFs configuration. After you configure this parameter, the function can access the specified PolarFs resources. |
|
| juiceFsConfig | JuiceFsConfig |
The JuiceFs mount configuration. |
|
| microSandboxConfig | MicroSandboxConfig |