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

Billing methods

Function Compute supports the following billing methods.

Trial quota

Function Compute provides free trial quota for the first-time users of Function Compute. An Alibaba Cloud account and RAM users share the trial quota. The following items provide the details of the trial quota:
  • vCPU: 500,000 vCPU-seconds
  • Memory: 1 million GB-seconds
  • Function invocations: 4 million
  • GPU memory: 100,000 GB-seconds
Note
  • 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.

Resource plans

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.

Pay-as-you-go

You are charged for the computing resources that you use. For more information, see Pay-as-you-go billing method.

Billable items

Important The prices in this topic are for reference only. The actual prices provided by the business managers prevail.

The billable items of Function Compute include function invocations, resource usage, and outbound Internet traffic. The following figure shows the details.

fc-billing

Function invocations

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 itemUnit price
Number of invocationsUSD 0.002 per 10,000 invocations

Resource usage

Billing formula

You can configure vCPU and memory specifications for function instances based on your business requirements. You are charged for the vCPU and memory usage. In Function Compute, you are charged based on the total resource usage of instances per month. The following formulas are used to calculate fees of resource usage:
  • 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

Terms

  • 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.

Billing units

The following units are used for the billing of resources:
  • vCPU-seconds

    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.

  • GB-seconds

    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.

Idle mode

Note The idle mode applies to only elastic instances, not GPU-accelerated instances.
Elastic instances are classified into active instances and idle instances. Instances that are allocated with vCPUs are active instances. Instances that are not allocated with vCPUs are idle instances.
  • 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.

For more information about the idle mode, see Configure provisioned instances and auto scaling rules.

Unit prices for each billable item

Billable itemUnit price
GPU usageUSD 0.000105/GB-seconds
Active vCPU usageUSD 0.00002138/vCPU-seconds
Idle vCPU usageUSD 0/vCPU-seconds
Memory usageUSD 0.000002138/GB-seconds
Disk usage
  • Usage ≤ 512 MB: free
  • Usage > 512 MB: USD 0.00000026/GB-seconds for the excess capacity

Outbound Internet traffic

In Function Compute, you are charged based on the total outbound Internet traffic. Fees for outbound Internet traffic = (Internet traffic within a function + Traffic for responses to requests + CDN back-to-origin traffic) × Unit traffic price.
  • 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 itemUnit price
Outbound Internet trafficUSD 0.117/GB
Note
  • 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.

Billing example

Important The billing examples in this topic are for reference only. The actual fees are subject to the prices provided by the business managers.

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.

vCPUCPU memoryGPU memoryNumber of invocationsExecution duration per requestMonthly fees
28192 MB4096 MB1 million requests1 second per requestUSD 480.06
  • Fees for function invocation: 1,000,000 × USD 0.002/10,000 = USD 0.20
  • Fees for vCPU usage: 2 vCPUs × (1,000,000 × 1 second) × USD 0.00002138/vCPU-seconds = USD 42.76
  • Fees for memory usage: 8,192 MB/1,024 × (1,000,000 × 1 second) × USD 0.000002138/GB-seconds = USD 17.10
  • Fees for GPU usage: 4,096 MB/1,024 × (1,000,000 × 1 second) × USD 0.000105/GB-seconds = USD 420.00
  • Total fees: Fees for function invocation + Fees for vCPU usage + Fees for memory usage + Fees for GPU usage = 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.

For example, you want to process 1 million 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. The memory usage fees are used as an example.
Usage modeFee 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 requestsIf 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

References