All Products
Search
Document Center

Function Compute:CreateFunctionInput

Last Updated:Nov 01, 2024
ParameterTypeDescriptionExample
object

The information about request parameters to create the function.

codeInputCodeLocation

The code of the function. The code must be packaged into a .zip file. You must configure either the code parameter or the customContainerConfig parameter.

cpufloat

The number of vCPUs of the function. The value is a multiple of 0.05.

1
customContainerConfigCustomContainerConfig

The configuration of the Custom Container runtime. After you configure the Custom Container runtime, Function Compute can execute the function in a Custom Container image. You must configure either the code parameter or the customContainerConfig parameter.

customDNSCustomDNS

The custom Domain Name System (DNS) settings.

customRuntimeConfigCustomRuntimeConfig

The configuration of the custom runtime.

descriptionstring

The description of the function.

my function
diskSizeinteger

The disk size of the function. Unit: MB. Valid values: 512 and 10240.

512
environmentVariablesobject

The environment variables of the function. You can access the environment variables configured in the runtime.

string
value1
functionNamestring

The name of the function. The name can contain only letters, digits, underscores (_), and hyphens (-). The name cannot start with a digit or a hyphen (-). The name must be 1 to 64 characters in length.

my-function-1
gpuConfigGPUConfig

The GPU configuration of the function.

handlerstring

The handler of the function. The handler format is related to the runtime you use.

index.handler
instanceConcurrencyinteger

The number of requests that can be concurrently processed by the instance.

1
instanceLifecycleConfigInstanceLifecycleConfig

The configuration of the lifecycle hook for the function instance.

internetAccessboolean

service config

true
layersarray

The layers. Multiple layers are merged based on the order of array subscripts. The content of a layer with a smaller subscript overwrites the file that has the same name as a layer with a larger subscript.

string

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

acs:fc:cn-beijing:186824xxxxxx:layers/fc_layer/versions/1
logConfigLogConfig

The log configuration. Function Compute writes function execution logs to the specified Logstore.

memorySizeinteger

The memory size of the function. Unit: MB. The value must be a multiple of 64. The memory size varies based on the function instance type you use.

512
nasConfigNASConfig

The configuration of the File Storage NAS (NAS) file system. This allows functions in the specified service to access the NAS file system.

ossMountConfigOSSMountConfig

The mount configuration of Object Storage Service (OSS).

rolestring

The Resource Access Management (RAM) role that is used to grant the required permissions to Function Compute. You can use the RAM role in the following scenarios: 1. Send the logs that the function generates to your Logstore. 2. Generate temporary tokens that are used to access other cloud resources during function execution.

acs:ram::188077086902****:role/fc-test
runtimestring

The runtime of the function.

python3.10
timeoutinteger

The timeout period for the execution of the function. Unit: seconds. Default value: 3. Minimum value: 1. When this period is elapsed, the function execution is terminated.

60
tracingConfigTracingConfig

The configuration of Managed Service for OpenTelemetry. After Function Compute is integrated with Managed Service for OpenTelemetry, you can record the duration of a request in Function Compute, view the cold start duration of a function, and record the execution duration of a function.

vpcConfigVPCConfig

The VPC configuration. This allows functions in the specified service to access the specified VPC.