Web functions are designed for HTTP-based workloads. Use a web function to run applications built on popular frameworks like Flask, Express, or Spring Boot, or to migrate an existing HTTP service to Function Compute without rewriting your code. Function Compute manages scaling and resource allocation at the function level, and each function runs independently.
To process event-driven workloads (such as OSS triggers or MNS messages), create an event function instead. For GPU-accelerated inference, create a GPU function. See Technical selection guide to compare all four function types.
Prerequisites
Before you begin, ensure that you have:
Logged in to the Function Compute console
(Optional) A virtual private cloud (VPC) configured, if the function needs to access VPC resources
(Optional) A NAS file system or OSS bucket, if the function needs persistent storage
Create a web function
In the left navigation pane, choose Function Management > Function List.
In the top menu bar, select a region. On the Function List page, click Create Function.
In the dialog box, select Web Function and click Create Web Function.
On the Create Web Function page, configure the following settings, then click Create.
Basic configurations
| Configuration item | Description | Example |
|---|---|---|
| Function Name | A unique identifier for the function. Must be unique within the same account and region, and comply with naming conventions. | myFunction |
| Specification Plan | Sets the vCPU, Memory, and Disk for the function. Billed by specification x usage duration. The vCPU-to-memory ratio must be between 1:1 and 1:4. All disk directories are writable and disk space is shared across the instance. Data on disk is lost when the instance is reclaimed — mount a NAS file system or OSS bucket for persistent storage. See Billing overview. | vCPU: 0.35, Memory: 512 MB, Disk: 512 MB (free, up to 10 GB quota) |
| Concurrency Per Instance | Number of requests a single instance can handle simultaneously. See Configure concurrency per instance. | 20 |
Elastic configurations
| Configuration item | Description | Example |
|---|---|---|
| Minimum Instances | Pre-allocates instances to reduce cold start latency. Set to 1 or higher for latency-sensitive workloads. If set to 1 or higher and no elastic policy is configured or currently valid, the current number of minimum instances equals the value you set here. If multiple elastic policies are active, the system uses the highest calculated value as the effective minimum. See Instance scaling rules. | Enabled |
Function code
| Configuration item | Description | Example |
|---|---|---|
| Runtime | Select Custom Runtime and choose a language or framework. For event functions, select Built-in Runtime. For GPU functions, select Custom Image. See Code development overview. | Custom Runtime > Node.js > Node.js 16 |
| Code Upload Method | How to provide function code: Use Sample Code (default), Upload A ZIP Package, Upload A Folder, or Upload From OSS (specify bucket and file name). | Use Sample Code |
| Startup Command | The command that starts your HTTP server. If left blank, create a script named bootstrap in the root directory of your code — Function Compute uses it to start the program. | npm run start |
| Listening Port | The port your HTTP server listens on. | 9000 |
| Execution Timeout | How long the function can run before being terminated. Default: 60 seconds. Maximum: 86,400 seconds. | 60 |
Permissions, network, and storage
| Configuration item | Description | Example |
|---|---|---|
| Function Role | A Resource Access Management (RAM) role that Function Compute uses to generate temporary credentials for accessing Alibaba Cloud resources. See Use a function role. | mytestrole |
| Allow Access To VPC | Enables the function to access resources inside a VPC. Requires VPC, vSwitch, and Security Group. See Configure network settings. | Enabled |
| Allow Default NIC To Access Public Network | Allows outbound internet access through the default network interface card (NIC). Important Disable this if you have configured a static public IP address — otherwise the static IP will not take effect. See Configure a static public IP address. | Enabled |
| Mount NAS File System | Mounts a NAS file system for persistent shared storage (for example, model files shared across inference functions). With automatic configuration, the system uses or creates a General-purpose NAS file system named Alibaba-Fc-V3-Component-Generated. See Configure a NAS file system. | Enabled |
| Mount OSS Object Storage | Mounts an OSS bucket for persistent storage of logs and business files. See Configure OSS. | Enabled |
Logs and tracing
| Configuration item | Description | Example |
|---|---|---|
| Log Feature | Saves function execution logs to Simple Log Service for debugging and analytics. Automatic Configuration selects (or creates) a log project that starts with serverless-<region_id> — one per region. Custom Configuration lets you specify the Log Project and Logstore manually. See Configure the logging feature. | Enabled |
More configurations
| Configuration item | Description | Example |
|---|---|---|
| Time Zone | Sets the time zone for the function. Automatically adds the TZ environment variable with the selected value. | UTC |
| Tags | Adds tags to group and manage functions. Requires both a tag key and a tag value. | key: value |
| Resource Group | Assigns the function to a resource group for organization. See Resource groups. | Default Resource Group |
| Environment Variables | Passes configuration values to the function without changing code. See Configure environment variables. | {"BUCKET_NAME": "MY_BUCKET"} |
Test the function
After creating the function, verify it works before further configuration.
On the Function Details page, click Test Function. The console displays the response and function logs in the output panel.
If the Code tab shows a change indicator (1 in the figure), click Deploy Code first to apply your latest edits, then click Test Function.

Edit a function
On the Function Details page, edit code directly on the Code tab. To export your code as a backup or upload new code for deployment, use the import/export options shown below.


For other configuration changes, see Configure a function.
Delete a function
On the Function List page, find the function and click Delete in the Actions column. Before confirming, make sure no triggers or elastic policies for minimum instances are still attached to the function.
Get the function ARN
An Alibaba Cloud Resource Name (ARN) uniquely identifies a Function Compute function and can be referenced in your code or other services.
In the left navigation pane, choose Function Management > Function List.
Select a region, then click the function name.
On the Function Details page, click Copy ARN on the right.

What's next
Choose a function type: Function Compute offers four function types — event, web, task, and GPU. See Technical selection guide to pick the right one for your workload.
Manage functions with APIs or CLI: Use the CreateFunction API or Serverless Devs as alternatives to the console.
Troubleshoot timeouts: If a function times out, see What do I do if a function execution times out with the error 'Function time out after'?
Reduce cold start latency: Infrequently invoked functions may experience slower first invocations. Set Minimum Instances to 1 or higher to keep instances warm. See Why do infrequently used functions have longer invocation times?