All Products
Search
Document Center

Billing methods

Last Updated: Jan 10, 2020

Function Compute is billed on a pay-as-you-go basis. The fee consists of executions cost, execution duration cost, and optional data transfer cost. Function Compute also provides a certain amount of free processing quota every month.

We provide a pricing calculator. You can estimate the cost based on the number of function calls per day, the memory configured for the function, and the function execution duration.

Note: A request is billed only after your function code is executed. Therefore:

  1. Requests whose response status code is 4XX or 5XX due to errors such as parameter, permission, and service errors will not be billed.
  2. Requests whose response status code is 200 but errors occurred during the execution of function code will be billed.
  3. Whether requests triggered by HTTP triggers will be billed is determined by the value of X-Fc-Error-Type in the response header. If the value is FCCommonError, the function is not executed and the corresponding request will not be billed. If the value is any other value, the corresponding request will be billed.

Executions cost

The executions cost indicates the total number of function executions per hour.

Price: USD 0.2/1 million executions.

Execution duration cost

Price: The price for 1 GB memory is USD 0.01668/GB-s or USD 0.001668/GB-100 ms.

Note: The execution duration cost depends on the memory size that you have allocated to functions and the duration of function execution. An execution duration starts when your function starts to run and ends when the result is returned or the execution is terminated. The duration measurement granularity is 100 milliseconds. Therefore, your execution duration is rounded up to the nearest 100 milliseconds. For example, if your function execution duration is 1,010 milliseconds, the duration is measured as 1,100 milliseconds.

Example: The function application of Alan’s website is allocated 2 GB of memory, and a function runs for 1,010 milliseconds. Alan is billed 0.01668 x (2 x 1.1) = USD 0.035028 for this function.

Data transfer cost

Data transfer cost is only incurred when data is transferred on the public network in your function.Data that is transferred on the public network includes two parts:

  1. Data that is returned from the public network when a function is called
  2. Data that is transferred to the public network when a function is called

The total public network traffic is charged based on Elastic Compute Service’s (ECS’s) pay-as-you-go billing method. It is currently charged as USD 0.117/GB. For more information, see ECS’s billing method for public network bandwidth.

For example, Alan calls a function and uploads a file of 10 MB to a public server in the function. The function returns the result of successful execution, which is a JSON string of 200 bytes. Then, the used public network traffic is 10 MB + 200 byte, and the cost is 0.117 x (10.0/1024 + 200.0/1024/1024/1024) = USD 0.00114.

Note:

  1. Traffic used for accessing the internal network of Alibaba Cloud is not deemed public network traffic and therefore will not be charged.
  2. If you use API Gateway to call a function and API Gateway is in the same region as Function Compute, the function is called within the internal network and no traffic cost is incurred.
  3. If you call a function in different regions, data transfer cost will be charged.

CDN back-to-origin data transfer cost

If you set content delivery network (CDN) back-to-origin processing to Function Compute, you need to pay for the traffic of transfer over the back-to-origin network.

The price of public network traffic in China is USD 0.117/GB. If your network traffic is heavy, submit a ticket for a quotation.

Subscription

Function Compute supports subscription. You can purchase a resource consumption plan for a certain duration in advance. Within its lifecycle, the resource consumption plan is deducted by second for the resources consumed by the execution of a function. By subscribing to Function Compute, you can spend less money on the same resources, substantially reducing your costs. For more information, see Function Compute (subscription).

More information

If you use other Alibaba Cloud service instances in your functions, you will be charged additional fees. For example, if you use a function to write data to Alibaba Cloud Object Storage Service (OSS), or to activate a Log Service instance to store debugging information, these service instances are charged additionally. For more information, see OSS billing items and Log Service billing methods.

Free monthly quotas

Your primary account and RAM user account share the free monthly quotas of executions and execution duration. Free quotas are automatically cleared at the beginning of each calendar month, rather than accrued to the next month.

  • Executions: The first one million calls per month are free of charge.

  • Execution duration: The first 400,000 GB*s per month are free of charge.

You can view the monthly free quotas, which is the number of free seconds for different memory sizes in the following table.

Memory (MB) Free seconds per month
128 3,200,000
192 2,133,333
256 1,600,000
320 1,280,000
384 1,066,667
448 914,286
512 800,000
576 711,111
640 640,000
704 581,818
768 533,333
832 492,308
896 457,143
960 426,667
1,024 400,000
1,088 376,471
1,152 355,556
1,216 336,842
1,280 320,000
1,344 304,762
1,408 290,909
1,472 278,261
1,536 266,667