Event-triggered functions execute your code in response to events from triggers such as Function Compute triggers, Object Storage Service (OSS) triggers, and RocketMQ triggers. Each function runs in isolation — one function's execution does not affect others. This document covers how to create, edit, delete, and retrieve the Aliyun Resource Name (ARN) of an event-triggered function using the Function Compute console.
Prerequisites
Before you begin, make sure you have:
An Alibaba Cloud account with access to the Function Compute console
Sufficient permissions to create functions in the target region
Create a function
The following steps walk you through creating an event-triggered function using a built-in runtime and sample code. After creation, replace the sample code with your own logic.
Log on to the Function Compute console. In the left navigation pane, choose Function Management > Function.
In the top menu bar, select a region. On the Function page, click Create Function.
In the dialog box, select Event Function as the function type, then click Create.
On the Create Function page, configure the following settings and click Create.
Basic configurations
| Parameter | Description | Example |
|---|---|---|
| Function name | A unique identifier for the function within the same account and region. Must follow naming conventions. | myFunction |
| vCPU | The number of virtual CPU cores allocated to the function. The vCPU-to-memory ratio must be between 1:1 and 1:4. | 0.35 vCPU |
| Memory | The memory allocated to the function. | 512 MB |
| Disk | Temporary disk space for the function instance. All directories are writable and the space is shared. Data is lost when the instance is reclaimed — mount a NAS file system or an OSS bucket to persist files. Function Compute provides a free tier of 10 GB disk space. | 512 MB |
Billing for each invocation is calculated by multiplying the resource specifications by the duration of use. For details, see Billing overview.
Scaling policy
| Parameter | Description | Example |
|---|---|---|
| Minimum instances | The minimum number of instances to keep running. Set to 1 or higher to pre-warm instances and reduce cold start latency for latency-sensitive workloads. If no elastic policy is configured or no valid policy is in effect, the effective minimum is the value you set here. If multiple elastic policies are active, Function Compute uses the highest value among them as the effective minimum. For details, see Instance scaling rules. | 1 |
Code
Configure the runtime environment and code source.
| Parameter | Description | Example |
|---|---|---|
| Runtime | The language and version for running your function code. Select Built-in Runtimes and choose a language such as Python, Java, PHP, or Node.js. To create a web function instead, select Custom Runtime. To create a GPU-accelerated function, select Custom Container. For available runtimes, see Function Compute runtimes. | Built-in Runtimes |
| Code upload method | How to provide your function code. Options: Use Sample Code (Hello World starter, editable later in the console), Upload ZIP (ZIP package, or JAR package for Java runtime only), Upload Folder, or OSS (specify a bucket and object). | Use Sample Code |
| Handler | The entry point that Function Compute calls to process requests. If you use Use Sample Code, keep the default. If you upload your own code, update this to match your handler function. An incorrect handler causes execution errors. | index.handler |
| Execution timeout period | The maximum time a single invocation can run. Default is 60 seconds; maximum is 86,400 seconds. | 60 |
Permissions, network, and storage
| Parameter | Description | Example |
|---|---|---|
| Function role | A RAM role that Function Compute uses to generate temporary credentials for accessing other Alibaba Cloud services. For setup details, see Grant Function Compute permissions to access other Alibaba Cloud services. | mytestrole |
| Access to VPC | Enable to allow the function to access resources inside a virtual private cloud (VPC). For configuration details, see Configure a network. | Enabled |
| VPC | Required when Access to VPC is enabled. Select an existing VPC or create a new one. | fc.auto.create.vpc.1632317**** |
| vSwitch | Required when Access to VPC is enabled. Select an existing vSwitch or create a new one. | fc.auto.create.vswitch.vpc-bp1p8248**** |
| Security group | Required when Access to VPC is enabled. Select an existing security group or create a new one. | fc.auto.create.SecurityGroup.vsw-bp15ftbbbbd**** |
| Allow default NIC to access internet | Controls whether the function can reach the internet through its default network interface controller (NIC). | Enabled |
| Mount a NAS file system | Mount a NAS file system to persistently share data across functions, such as model files used by multiple inference functions. With automatic configuration, the system uses or creates a General-purpose NAS file system named Alibaba-Fc-V3-Component-Generated. For details, see Configure a NAS file system. | Enabled |
| Mount OSS | Mount an OSS bucket to persistently store logs, business files, and other data. For details, see Configure Object Storage Service (OSS). | Enabled |
When using a static public IP address, disable Allow default NIC to access internet. Otherwise, the static public IP address does not take effect. For details, see Configure a static public IP address.
Logs and tracing
| Parameter | Description | Example |
|---|---|---|
| Logging | Persist function execution logs to Simple Log Service for debugging, fault analysis, and data analytics. Automatic Configuration uses or creates a log project named serverless-<region_id> (one per region). Custom Configuration lets you specify the Log Service Project and Logstore. For details, see Configure the logging feature. | Enabled |
More configurations
| Parameter | Description | Example |
|---|---|---|
| Time zone | The time zone for the function. Setting this adds a TZ environment variable with the selected value. | UTC |
| Tag | Tags for grouping and managing functions. Each tag requires a key and a value. For details, see Function tags. | key : value |
| Resource group | The resource group the function belongs to. For details, see Resource groups. | Default Resource Group |
| Environment variables | Key-value pairs injected into the function's execution environment, letting you change function behavior without modifying code. For details, see Configure environment variables. | {"BUCKET_NAME": "MY_BUCKET", "TABLE_NAME": "MY_TABLE"} |
Edit a function
On the Function Details page, use the Code tab to modify your function code directly in the console. You can also export code as a backup or upload new code.
If the left panel shows uncommitted changes (indicated by ①), click Deploy before clicking Test Function to apply your changes.

To export or upload code:


For other configuration changes such as instance specifications and scaling, see Function instance specifications and elastic configurations.
Delete a function
Log on to the Function Compute console. In the left navigation pane, choose Function Management > Function.
Locate the function and click Delete in the Actions column.
In the confirmation dialog, verify that the function has no attached resources (such as triggers or minimum-instance elastic policies), then confirm the deletion.
Get the ARN of a function
An Aliyun Resource Name (ARN) uniquely identifies an Alibaba Cloud resource and lets you reference functions from code or other services.
Log on to the Function Compute console. In the left navigation pane, choose Function Management > Function.
In the top menu bar, select a region. Click the target function.
On the Function Details page, click Copy ARN on the right.

What's next
Function Compute supports four function types for different scenarios: event-triggered functions, web functions, task functions, and GPU-accelerated functions. To choose the right type, see Technology selection guide.
To manage functions with the API or CLI, see the CreateFunction API reference and Get started with Serverless Devs.
If a function times out with the error "Function time out after", see Troubleshoot function timeout errors.
Infrequently invoked functions may have longer response times due to cold starts. To eliminate cold start latency, set Minimum instances to
1or higher. For background, see Why infrequently used functions take longer to invoke.