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

Function parameters

When you create a function, you must set the parameters that are described in the following table.
Parameter Required Description
FunctionName Yes The name of the function. The name must be unique in the current service and meet the following requirements:
  • The name can contain letters, digits, 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 of the function.
Code Yes The code package for the function. If you use Java, you must upload a JAR package. If you use other programming languages, you must upload a ZIP package. The package can be stored in Object Storage Service (OSS) or directly uploaded.
Handler Yes The handler used by Function Compute to invoke your function.
Description No The description of the function. Function Compute does not use the value of this parameter. However, we recommend that you specify a simple and clear description for your service.
Timeout No The maximum execution time for the function. Unit: seconds.
InstanceType No The type of the instance that executes the function. Valid values:
  • e1: elastic instance
  • c1: performance instance
MemorySize No The memory required to execute the function. Unit: MB. Valid values: [128, 3072]. The increment step size of the memory is 64 MB.
Initializer No The handler used by Function Compute to invoke your initializer function.
InitializationTimeout No The maximum execution time for the initializer function. Unit: seconds.

You can modify all parameters subsequently except FunctionName.

Supported runtime environments

Runtime environment Description Documentation
Node.JS 6.x Node.js 6.x Node.js runtime environments
Node.JS 8.x Node.js 8.x
Node.JS 10.x Node.js 10.x
Node.JS 12.x Node.js 12.x
Python 2.7 Python 2.7 Python runtime environment
Python 3 Python 3.6
PHP 7.2 PHP 7.2.7 PHP runtime environment
Java 11 Java 11 Java runtime environment
Java 8 Java 8
.NET Core 2.1 .NET Core 2.1 .NET Core runtime environment
Custom Runtime N/A Custom runtime environment
Custom Container N/A Custom container runtime


Manage a function