This topic describes the billing methods and billable items of Function Compute, and provides billing examples.
Function Compute supports the following billing methods.
- vCPU: 500,000 vCPU-seconds
- Memory: 1 million GB-seconds
- Function invocations: 4 million
- GPU memory: 100,000 GB-seconds
- The trial quota is valid for three months. You are charged on the pay-as-you-go basis for the excess resource usage.
- The trial quota cannot be used to offset the fees of outbound Internet traffic and disk usage. If you do not purchase resource plans, the disk usage exceeding 512 MB and the outbound Internet traffic are billed on the pay-as-you-go basis.
Function Compute provides the following types of resource plans: vCPU resource plans, memory resource plans, GPU resource plans, function invocation plans, and outbound Internet data transfer plans. You can use these resource plans to offset fees of the corresponding billable item. For more information, see Billable items. If your resource plan has a remaining quota, the resource plan is preferentially used to offset the fees for resource usage. After the quota in your resource plan is exhausted, the pay-as-you-go billing method is used for the resources that cannot be offset.
Resource plans allow you to use the same amount of resources at more favorable prices. This helps you reduce the costs. For more information, see Resource plans.
You are charged for the computing resources that you use. For more information, see Pay-as-you-go billing method.
The billable items of Function Compute include function invocations, resource usage, and outbound Internet traffic. The following figure shows the details.
In Function Compute, you are charged based on the total number of function requests per month. Fees for function invocations = Number of invocations x Unit price
|Billable item||Unit price|
|Number of invocations||USD 0.002 per 10,000 invocations|
- Fees for vCPU usage = vCPU used by instances × Execution duration (s) × Unit price
- Fees for memory usage = Memory used by instances (GB) × Execution duration (s) × Unit price
- Computing power of instances: The computing power of an instance is proportional to the number of vCPUs and the memory size that is configured for the instance. To simplify the billing model, Function Compute uses the number of vCPUs or the memory size (GB) of an instance to indicate the computing power of the instance. For example, an instance with 2 vCPUs has twice the computing power of an instance with 1 vCPU, and an instance with 2 GB of memory has twice the computing power of an instance with 1 GB of memory.
- Execution duration: Function Compute supports provisioned and on-demand instances. The execution durations of provisioned instances and on-demand instances are measured by using different methods. For more information, see Instance types and instance modes.
1 vCPU-seconds indicates that an instance with 1 vCPU runs 1 second, or an instance with 0.5 vCPU runs 2 seconds, and so on.
1 GB-seconds indicates that an instance with 1 GB of memory runs 1 second, or an instance with 512 MB of memory runs 2 seconds, and so on.
- Active instances
An instance that is processing requests or for which the Idle Mode feature is disabled is an active instance.
- Idle instances
A provisioned instance for which Idle mode is enabled and not processing requests is an idle instance.
Unit prices for each billable item
|Billable item||Unit price|
|GPU usage||USD 0.000105/GB-seconds|
|Active vCPU usage||USD 0.00002138/vCPU-seconds|
|Idle vCPU usage||USD 0/vCPU-seconds|
|Memory usage||USD 0.000002138/GB-seconds|
Outbound Internet traffic
- Internet traffic within a function: the traffic that is generated when a function sends requests over the Internet.
- Traffic for responses to requests: the traffic that is generated when the function returns a response after the function is executed over the Internet.
- CDN back-to-origin traffic: the traffic that is generated when Function Compute is used as the origin for Alibaba Cloud CDN (CDN).
|Billable item||Unit price|
|Outbound Internet traffic||USD 0.117/GB|
- Traffic over the internal network is free of charge.
- Inbound Internet traffic is free of charge. Examples of inbound traffic: the traffic that is generated when data is returned after the request that is initiated by a function over the Internet, and the traffic that is generated when the client sends a request to invoke a function.
- The billing granularity for outbound Internet traffic is 1 KB. The total billable amount of outbound Internet traffic used per month is rounded to two decimal places.
The following table describes an example on how to calculate the monthly fees for a pay-as-you-go instance. In this example, the outbound Internet traffic is 0 KB.
|vCPU||CPU memory||GPU memory||Number of invocations||Execution duration per request||Monthly fees|
|2||8192 MB||4096 MB||1 million requests||1 second per request||USD 480.06|
Note If you use a provisioned instance, the execution duration in the preceding example is 86,400 seconds.
Reduce costs with high instance concurrency
Alibaba Cloud Function Compute supports multiple concurrency of an instance. You can reduce costs when you reuse resources to process a large number of requests. For more information, see Configure instance concurrency.
|Usage mode||Fee for 1 million requests|
|A single instance that processes a single request|
Memory usage fee = 1,000,000 × 1 second × USD 0.000002138/GB-seconds = USD 2.138
|A single instance that concurrently processes multiple requests||If the concurrency for a single instance is 10, |
Memory usage fee = 1,000,000 × 1 second/10 × USD 0.000002138/GB-seconds = USD 0.2138