A function is a scheduling and operational unit in the Function Compute system. A function must belong to a service. All functions of a service share the same settings, such as service authorization and log configuration.

Function parameters

When you create a function, you must specify the parameters described in the following table.
Parameter Required Description
FunctionName Yes The name of the function. The function name must be unique within the current service and comply with the following constraints:
  • The name consists of letters, numbers (0-9), underscores (_), and hyphens (-).
  • The name must start with a letter or an underscore (_).
  • The name is case-sensitive.
  • The name must be 1 to 128 characters in length.
Runtime Yes The runtime environment type of the function.
Code Yes The code package for the function. If you are using Java, you must upload a JAR package. If you are using other languages, you must upload a ZIP package. The package can be stored in Object Storage Service (OSS). Alternatively, you can directly upload a code package.
Handler Yes The handler used by the Function Compute system to run your function.
Description No The description of the function. The Function Compute system does not use the value of this parameter. However, we recommend that you set a simple and clear description for your function.
Timeout No The maximum execution time for the function. Unit: seconds.
MemorySize No The maximum capacity of the memory that is required to run the function. Unit: MB. Value range: [128, 3072]. The value increases at the increment of 64 MB.
Initializer No The handler used by the Function Compute system to run your initializer function.
InitializationTimeout No The maximum execution time for the initializer function. Unit: seconds.

You can modify all parameters subsequently except FunctionName.

Supported function runtime environments

Runtime environment type Description Topic
Node.js6 Node.js 6.10.3 Node.js runtime environment
Node.js8 Node.js 8.9.0
Node.js10 Node.js 10.15.3
Node.js12 Node.js 12.16.1
Python2.7 Python 2.7 Python runtime environment
Python3 Python 3.6
PHP7.2 PHP 7.2.7 PHP runtime environment
Java8 Java 8 Java runtime environment
dotnetcore2.1 .NET Core 2.1 .NET Core runtime environment

References

Function operations