All Products
Search
Document Center

Function Compute:CreateFunctionInput

Last Updated:Jun 26, 2026

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 vCPUs. The value must be a multiple of 0.05 vCPU. Minimum value: 0.05. Maximum value: 16. The ratio of cpu to memorySize (in GB) must be between 1:1 and 1:4.

1

customContainerConfig CustomContainerConfig

The configuration for the custom container runtime. After this parameter is configured, the function can use a custom container image for execution. 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

环境变量的值。

value1

functionName

string

The name of the function. The name can contain only letters, digits, underscores (_), and hyphens (-). The name 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 depends on the runtime.

index.handler

instanceConcurrency

integer

The maximum concurrency of an instance.

1

instanceLifecycleConfig InstanceLifecycleConfig

The instance lifecycle hook 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. Files in a layer with a smaller index overwrite files with the same name in a layer with a larger index.

string

层 ARN。

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. Minimum value: 128. Maximum value: 32768 (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 this parameter is configured, the function can access the specified NAS resources.

ossMountConfig OSSMountConfig

The OSS mount configuration.

role

string

The RAM role that the user grants to Function Compute. After this parameter is set, 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. Supported runtimes: 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. Minimum value: 1. Maximum value: 86400. Default value: 3. The function is terminated if it exceeds this time limit.

60

tracingConfig TracingConfig

The Tracing Analysis 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 within functions.

vpcConfig VPCConfig

The VPC configuration. After this parameter is configured, the function can access the specified VPC resources.

tags

array

The list of tags.

Tag

标签信息。

disableOndemand

boolean

Specifies whether to disable the creation of on-demand instances. If this feature is enabled, on-demand instances are not created and only provisioned instances can be used.

sessionAffinity

string

The 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 are not injected with STS tokens.

resourceGroupId

string

instanceIsolationMode

string

The instance isolation mode.

sessionAffinityConfig

string

The affinity configuration that corresponds to the sessionAffinity type. For MCP_SSE affinity, specify MCPSSESessionAffinityConfig. For cookie-based affinity, specify CookieSessionAffinityConfig. For header field affinity, specify HeaderFieldSessionAffinityConfig.

{\"sseEndpointPath\":\"/sse\", \"sessionConcurrencyPerInstance\":20}

idleTimeout

integer

The deferred release time of the instance.

100

disableInjectCredentials

string

Specifies whether to disable STS token injection. Valid values:

  • None: STS tokens are injected in all methods.

  • Env: STS tokens are not injected through environment variables.

  • Request: STS tokens are not injected in requests, including context and headers.

  • All: STS tokens are not injected in any method.

Env

polarFsConfig PolarFsConfig

The PolarFs configuration. After this parameter is configured, the function can access the specified PolarFs resources.

juiceFsConfig JuiceFsConfig

microSandboxConfig MicroSandboxConfig