Function Compute

A fully hosted and serverless running environment that takes away the need to manage infrastructure such as servers and enables developers to focus on writing and uploading code.

Buy Now Contact Sales


Alibaba Cloud Function Compute is an event driven, serverless computing platform that enables developers to build and deploy their services without the need to manage any infrastructure. It seamlessly handles the resource management, auto scaling, and load balancing so you can focus on your business logic and increase your development velocity. You can also setup various event sources from other Alibaba services to automatically trigger your code to run. The best part is you only pay for the resources your code actually consumes to the nearest 100 milliseconds.



  • The code and configurations are stored in OSS with automatic and multi-level redundant backup.


  • Real time auto scaling and dynamic load balancing in several milliseconds.


  • Provides enterprise-class secure sandbox running environment.

  • Built-in tenancy isolation.

  • Provides various service authorization and main/sub-accounts to ensure access security.


  • Usage-based billing.

  • No maintenance staff required and zero hosting fees.

  • There are no network charges for accessing data with other Alibaba Cloud services in the same region.


  • Integration with various Alibaba Cloud services, which allows you to make and quick and simple configurations within the console.

  • Auto scaling and load balancing.

  • A sandbox environment for running your code, no configuration required.

  • Easy to set up triggers.

Product Details

Function Compute automatically allocates and scales resources, including CPU, memory and network bandwidth, to execute your functions based on the workload of traffic. Learn more about Function Compute features below including code management, supported runtime environments, auto scaling, monitoring, and function templates.


Code Management

Function Compute provides several ways to manage function code and store code securely. Upon function invocation, the system will automatically download and run the code. You can download the latest code through Get Function Code API.

  • Edit Code in the Console. This method is suitable for editing code that does not have external dependencies and requires compilation, such as NodeJS and Python.
  • Compress all code and dependencies into a zip or jar package and upload it to Function Compute directly.
  • Compress all code and dependencies into a zip or jar package and upload it to OSS, and then create the function by specifying the bucket and object key. This is recommended for large packages.
  • Supports a Variety of Runtime Environments

    Function Compute supports a variety of runtime environments. Currently supported languages include Python 2.7 and 3.6, Node.js 6 and 8, and Java 8. More runtimes will be made available in the future.

    Auto Scaling

    Function Compute provides real-time auto scaling within several milliseconds based on demand. Dynamic load balancing distributes the demand to nearly infinite compute resources without requiring any manual configurations or operations, which meets the needs of supporting up to millions of concurrent requests.


    Multiple event sources are supported. Triggers connect the functions with event sources. When a trigger condition is met, event source notifies Function Compute which in turn runs the corresponding function code and scale in/out underlying resources automatically, which leads to a higher computing efficiency. Functions can also be invoked directly.

    Monitoring and Logs

    Function Compute provides precise logs for you to easily view how each function is running, debug and test your code. In addition, it reports relevant monitoring metrics so you can quickly gain an overall understanding of how each function is running. You can also customize the monitoring metrics for function running to enable more extensive and thorough monitoring of functions.

    Function Templates

    Function Compute provides a large number of function templates and sample codes. You can use these templates to quickly create functions, such as API Gateway backend, web crawlers, automatic image classification, or organizing access to OSS, Table Store, Log Service, and other Alibaba Cloud services.

    Pay Per Use

    Function Compute makes it easy and cost-effective to scale your usage from several requests each day to thousands of requests each second, without worrying about idle resources.

    Billing is metered in increments of 100 milliseconds. Users only need to pay for the number of requests, the actual time and resource consumed for running their code, and the data transfer out to the Internet.

    Customize Resources

    Function Compute provides a simple way to allocate resources based on memory size. You select the size of memory for running functions, and Function Compute allocates other resources such as CPU power, network bandwidth, and disk I/O proportionally.


    Billing Items

    Alibaba Cloud Function Compute is billed on a Pay-As-You-Go basis. The fee consists of three parts and the Internet Traffic Fee is optional. Users are only charged the Internet Traffic Fee when using the Internet to transfer function data.

    Total Fee = Request Fee + Duration Fee + Public Network Traffic Fee (optional)

    Free Tier

    The monthly free quota is shared by the primary account and sub-account.

    Requests: The first 1 million calls per month are free of charge.

    Duration: The first 400,000 GB-seconds per month are free of charge.

    NOTE: Free calls and execution duration are automatically cleared at the beginning of each calendar month, rather than accrued to the next month.

    Request Fee

    The call count indicates the total number of function calls.

    Price: $0.2 / 1 million calls

    Duration Fee

    An execution duration starts when your code begins to be executed and ends when the result is returned or execution is terminated. The measurement granularity is 100 milliseconds. The duration price depends on the memory size that you have allocated to functions.

    Price: $ 0.00001667/GB-second ($ 0.000001667/ GB-100 milliseconds)


    The unit of duration fee is GB-second, which means that when the memory size is 1 GB, the duration is charged by the second. If your function memory size is 512 MB, the duration price is calculated as follows: $0.00001667/2 = $0.000008335 / GB-second.

    The duration measurement granularity is 100 milliseconds; therefore, your execution duration is rounded up to a multiple of 100 milliseconds. For example, if your function execution duration is 1,010 milliseconds, the duration is measured as 1,100 milliseconds.

    Therefore, if the execution duration of a function with a 512 MB memory is 1,010 milliseconds, the execution duration fee is calculated as follows: (0.5 × 1.1) GB-second × $0.000001667 / GB-second = $0.00000091685.

    Public Network Traffic Fee

    RegionPrice (USD/GB/Hour)
    Mainland China0.125
    Asia Pacific SE 1 (Singapore)0.117
    Asia Pacific SE 2 (Sydney)0.130
    US East 1 (Virginia)0.078
    US West 1 (Silicon Valley)0.078
    Germany 1 (Frankfurt)0.070

    Quick Calculation Table For Monthly Free Quota

    The table below shows the free tier seconds and the approximate price per 100ms.

    Memory (MB)Free Tier Seconds Per Month


    Analytic Processing of Media Assets

    Function Compute provides an event trigger mechanism to easily build a full data processing pipeline. An OSS upload action can trigger multiple functions to process OSS objects for data transcoding and extraction. With the OSS event trigger, you can quickly integrate different services with OSS to build a highly usable elastic video processing backend system.

    What is Offered

  • Low Cost
  • A highly usable elastic video backend system, allowing you to only pay for the resource usage.

  • FaaS Architecture
  • Adapts FaaS style architecture to achieve high availability and performance.

    Serverless Backend Services

    Function-as-a-Service (FaaS) is flexible and scalable. Combining Function Compute with API Gateway, you can build FaaS style backend services to handle API requests. With Function Compute and API Gateway, it is easy to build flexible and scalable backend services to power your personalized application

    What is Offered

  • Auto Scaling
  • Real time auto scaling and dynamic load balancing in a few milliseconds. This helps you shift peak load and handle traffic surges with ease.

  • Flexible Trigger
  • Integration with various cloud services to support computing scenario needs.

    Real Time IoT Message Processing

    Real-time streaming data can be categorized and processed by Function Compute efficiently and written back into the backend storage. For example, you can filter, aggregate, transform and analyze data generated by IoT devices in real time, and export the output into databases.

    What is Offered

  • Auto Scaling
  • Real-time auto scaling and dynamic load balancing in a few milliseconds. This helps you shift peak load and handle traffic surges with ease.

  • Flexible Trigger
  • Integrates with various cloud services to support computing needs in various scenarios.

    Getting Started

    Function Compute is a fully hosted, event-driven compute service. All you need to do is supply your code in one of the languages that Function Compute supports. You can invoke your code using SDKs and RESTful API and easily build a data processing trigger for Alibaba Cloud products such as Object Storage Service, Log Service, API Gateway and Table Store to run your code in response to events such as the ObjectCreated and ObjectRemoved events of OSS.


    1) Developer writes the code in supported languages, including Java, Node.js, python, etc.

    2. Upload the code to Function Compute using API or SDK, or upload on the console page, or upload with the command line tool Fcli.

    3) Trigger the execution of your code using API and SDK or the event source of cloud products.

    4) During the execution, Function Compute scales dynamically according to the user request volume to handling requests that come in peaks, while being transparent and imperceptible to users.

    5) After the function is executed, you can check the execution cost in the billing section, which is dependent on the actual execution time of the functions rounded up to the nearest value. For details, please see billing items.

    Alibaba Cloud Function SDK & API Reference

    Access the web-based Alibaba Cloud Function SDK & APIs to programmatically manage and achieve greater control of your product resources.


    The following resources offer detailed information regarding Alibaba Cloud Function Compute.

    Developer Resources

    See the links below for advanced features and Documentation. These resources are useful for developers wishing to integrate Alibaba Cloud Function Compute with their existing applications or to improve product configurations.


    Related Services


    1. As only Node.js, Python and Java are supported by Function Compute, how can I run C++ programs?

    We will support more languages based on customers’ feature requests. Please try the following methods if your program is written in a language that we do not currently support:

    • Rewrite the program in languages that Function Compute supports. Node.js and Python provide a wide range of libraries and are more efficient in terms of development.

    • Compile C/C++ programs into executable files, and run the files by fork with system calls.

    • Compile C/C++ modules as shared libraries, and use libraries by binding in Python. The following table lists the advantages and disadvantages of these approaches:

    2. Why doesn't Function Compute support custom Docker images?

    It is not difficult to support custom Docker images but it can become difficult to support large size custom images. To ensure real-time scalability, the system must be able to start the container within a short period of time. It could take several minutes to download a large image, which makes performance unacceptable. We recommend that you develop your application as micro-services, and decouple functions so that each function has a clear responsibility. As a result, function code does not involve complex dependencies and is therefore easy to build.

    3. How to automatically install dependencies?

    Function Compute requires users to upload code as a zip file containing all dependencies. Dependencies management approach varies with different languages. For example, with Node.js, you can use npm to install the dependent packages to code directory, compress to zip and then create/update function with the zip file. You can also take advantage of the CLI tool fcli to install and zip the dependencies, more information.

    4. What if my application will generate a large file or a large space is required? Where can I turn to for help?

    There is a temporary storage space of 512 MB available for function execution. If this space is insufficient, please consider using a streaming pattern to process the data. For example, using a stream processing can reduce the memory consumption of a function from 1 GB to 256 MB and the duration from several minutes to 10 seconds. Please contact us if this approach does not satisfy your business requirements.

    5. Where can I get the information of how much memory is consumed for function execution?

    You can find information such as highest memory consumption in LogResult header of Sync invocation. Alternatively, you can view the resource consumption Cloud Monitoring Service (CMS) metrics.

    6. Can one function invoke another function?

    Functions can invoke other functions. Functions can run on different servers, so they are called by remote RPC. You can use FC Invoke Function API to call specified functions.

    7. How do I kill a function execution that causes an infinite loop?

    There are two types of infinite loops: 1) A infinite loop caused by logic of a single function. 2) An infinite recursion in calling multiple functions that cannot be aborted. For example, function A calls function B, and function B calls function A. The first case is easier to handle. Once a function is timed out, the system terminates the execution automatically, and a time-out error message is returned without causing further financial loss. The second case can be problematic as this kind of invoke is allowed by the service. For this case, you will need to set up the monitoring alarm based on function-level metrics. Also, a maximum concurrency function is enforced by the customer to make your financial costs manageable.

    8. The default maximum concurrency per user is 100. Does this mean the service I build could process only 100 requests per second? That seems to be insufficient.

    QPS is related to some extent to the maximum concurrency but is still a different concept. You can estimate QPS by the following formula: QPS * Function Duration = Concurrency. For example, if you expect 10,000 requests per second, and the average request processing time is 1 second, the required concurrency limit needs to be greater than 10,000. If the average request processing time is 10 milliseconds, the required concurrency limit is 10,000 * 0.01 (second) = 100. For details, please see related documentation. In addition, the concurrency is set to protect users from spending expected cost such as the infinite recursion in calling multiple functions each other and that cannot be aborted in the previous example. If the default value is not sufficient, please contact us to adjust the limit.

    9. Is my execution environment isolated and secure? How is that guaranteed?

    Function Compute takes security as the highest priority in every aspect of the product and system design. Your function execution environment has the same level of isolation as Alibaba Cloud ECS instances, i.e. the isolation is at the virtual machine level and not container level. Furthermore, we provide strict protection on the network, storage, codes, and anti-DDoS attacks to ensure the security of your function.

    10. Will execution environment be released after functions return? Can I reuse the resource or status buffered by the last invocation?

    Functions run inside containers and containers are not immediately released after functions return. Containers will only be released when no request is received within a certain period of time (from several minutes to dozens of minutes, depending on the scheduling algorithm of the system). If requests are received consecutively, functions are considered long-living. Therefore, you can buffer resources, such as global variables, to optimize the performance. However, the correctness of your program should not rely on the assumption that the buffer is available all the time. For example, the buffered data can become unavailable when the container or the server is down.

    11. How can I bulk download logs generated by function execution?

    If your logs are saved in Log Store (Alibaba Cloud Log Service), you can view and download related contents using Log Service APIs.

    12. The function was invoked successfully, why can I not see any metrics, such as number of invocations, on the Cloud Monitoring console?

    Check if the account you use is a subaccount and if the account has at least read-only permission of Cloud Monitoring Service.

    13. How does Function Compute access a RDS database?

    As Function Compute containers are not running on fixed IPs, you will need to allow access from ALL IP, which can be a security risk and which we don't recommend. Function Compute is working on support access resources inside a user VPC. Once the feature is available, users can access resources inside VPC securely after granting access to Function Compute.

    14. Why do I get “The AccessKeyID does not exist” error by using access/secret key ID obtained from function context parameter?

    Function context parameter provides temporary credentials to access Alibaba Cloud resources which consists of a 3-tuple: access key ID, access key secret and security token. Ensure “security token” is also provided.