This topic describes the billing of Function Compute, including the billing methods, billable items, and unit prices, and provides billing examples.

Billing methods

Function Compute supports the following billing methods:

  • Free quota: Function Compute provides you with the free monthly quota. Your Alibaba Cloud account and RAM users share the quota of requests and execution duration of functions. The free monthly quota does not accumulate. At 00:00:00 on the first day of each calendar month, the free quota of the last month is cleared and recalculated. The free monthly quota consists of the following items:
  • Pay-as-you-go: You are charged for the computing resources that you use.
Note The free quota is first used to offset the resources that you consume. After the free quota is used up, you are charged based on the pay-as-you-go billing method.

Unit prices

The following table describes the billable items and the unit prices of Function Compute.
Billable item Unit price
Requests USD 0.2 per 10,000 requests
Resource usage of instances USD 0.000016384/GB-s
Outbound Internet traffic
  • Traffic within a function: USD 0.117/GB
  • Traffic for responses to requests: USD 0.117/GB
  • CDN back-to-origin traffic: USD 0.117/GB

Billable items

Notice If you use other Alibaba Cloud services together with your functions, you are charged for using those services. For example, you are charged for using Object Storage Service (OSS) or Log Service if you use a function to write data to OSS or use Log Service to store the logs of your functions.
  • Function invocation fees = Number of requests x Unit price

  • Fees for resource usage of instances = Computing capacity of instances (GB) × Execution duration (s) × Unit price
    • Computing capacity of instances: The computing capacity of an instance is proportional to the memory size that is allocated to the instance. To simplify the billing model, Function Compute uses the memory size (GB) of an instance to indicate the computing capacity of the instance.
    • Execution duration: Function Compute supports provisioned and on-demand instances. The execution duration of provisioned instances and on-demand instances are measured in different ways. For more information, see Instance types and instance modes.
  • Fees for outbound Internet traffic = Traffic within a function × Unit traffic price + Traffic for responses to requests × Unit traffic price + CDN back-to-origin traffic × Unit traffic price
    • Traffic within a function: the traffic that is generated when the function accesses the Internet and sends requests to the Internet.
    • Traffic for responses to requests: the traffic that is generated when the function returns a response after a function is executed.
    • CDN back-to-origin traffic: the traffic generated when Function Compute is used as the origin for Alibaba Cloud CDN.
    Notice
    • Traffic over the internal network is free of charge.
    • Inbound Internet traffic is free of charge. Examples of inbound Internet traffic: the traffic generated when data is returned after the request that is initiated by a function over the Internet is executed, and the traffic generated when the client sends a request to invoke a function.

Billing examples

The following table describes how to calculate the monthly fees for a pay-as-you-go instance.

Memory size Requests Execution duration per request Bandwidth Monthly fees
512 MB 3 million 1 second 0 USD 18.4224 = (512 MB/1024 × 3,000,000 × 1s - 400,000 GB-s) × USD 0.000016384/GB-s + (3,000,000 - 1,000,000) × USD 0.2/1,000,000
128 MB 30 million 200 milliseconds 0 USD 11.5344 = (128 MB/1024 × 30,000,000 × 0.2s - 400,000 GB-s) × USD 0.000016384/GB-s + (30,000,000 - 1,000,000) × USD 0.2/1,000,000
128 MB 25 million 200 milliseconds 0 USD 8.4864 = (128 MB/1024 × 25,000,000 × 0.2s - 400,000 GB-s) × USD 0.000016384/GB-s + (25,000,000 - 1,000,000) × USD 0.2/1,000,000
448 MB 5 million 500 milliseconds 0 USD 12.1664 = (448 MB/1024 × 5,000,000 × 0.5s - 400,000 GB-s) × USD 0.000016384/GB-s + (5,000,000 - 1,000,000) × USD 0.2/1,000,000
1024 MB 2.5 million 1 second 0 USD 34.7064 = (1024 MB/1024 × 2,500,000 × 1s - 400,000 GB-s) × USD 0.000016384/GB-s + (2,500,000 - 1,000,000) × USD 0.2/1,000,000

Benefits

Function Compute allows you to concurrently process requests by using a single instance, and you are charged for the resource usage of the instance. You can reduce costs by reusing resources to process a large number of requests.

For example, you want to process 1,000,000 requests and 1 second is required to process each request. The following table compares the fees for a single instance that processes a single request and the fees for a single instance that concurrently processes multiple requests.
Usage mode Fees for 1,000,000 requests
A single instance that processes a single request

Resource usage fee = 1,000,000 × 1 second × USD 0.000016384/GB-s= USD 16.384

A single instance that concurrently processes multiple requests In this example, the instance can concurrently process 10 requests.

Resource usage fee = 1,000,000 × 1s/10 × USD 0.000016384/GB-s = USD 1.6384

References