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

Billing methods

Function Compute supports the following billing methods.

Trial quota

Function Compute provides a free trial quota for the first-time users of Function Compute. The Alibaba Cloud account share the trial quota with RAM users. The following items provide the details of the trial quota.

  • vCPU: 500,000 vCPU-seconds
  • Memory: 1 million GB-seconds
  • Requests: 1 million
Important
  • The trial quota is valid for one year.
  • The trial quota does not cover GPU usage and outbound Internet traffic. If you do not purchase resource plans, you are charged for the GPU usage and outbound Internet traffic based on the pay-as-you-go billing method. The disk usage that exceeds 512 MB is also 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.

Note The billing methods are used in the following order: trial quota, resource plans, and pay-as-you-go. For more information, see Offset order.

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 the number of function requests, resource usage, and outbound Internet traffic.

Number of function requests

In Function Compute, you are charged based on the total number of function requests per month. Fees for function requests = Number of requests x Unit price

Billable item Unit price
Number of requests USD 0.002 per 10,000 requests

Resource usage

Billing formulas

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. You can use the following formulas to calculate resource usage costs:
  • 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. To simplify the billing, 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 means 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 means 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 billing

Note The idle billing feature can be applied only to elastic instances, not GPU-accelerated instances.
Elastic instances are classified into active instances and idle instances. If instances are allocated vCPUs, the instances are active. If instances are not allocated vCPUs, the instances are idle.
  • Active instances

    Instances that are processing requests or for which Idle Billing is turned off are active instances.

  • Idle instances

    The provisioned instances for which Idle Billing is turned on and not processing requests are idle instances.

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

Unit prices for each billable item

Billable item Unit price
GPU USD 0.000105/GB-seconds
Active vCPU USD 0.00002138/vCPU-seconds
Idle vCPU USD 0.000002138/vCPU-seconds
Memory USD 0.000002138/GB-seconds
Disk
  • Usage ≤ 512 MB: Free of charge
  • 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 per month. 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 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
Important
  • Traffic over the internal network is free of charge.
  • Inbound Internet traffic is free of charge. Examples: 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.

vCPU CPU memory GPU memory Number of requests Execution duration per request Monthly fees
2 8192 MB 4096 MB 1 million requests 1 second per request USD 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

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 Specify the 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 mode Fee for 1 million requests
A single instance that processes a single request

Memory usage fee = 1,000,000 × 1 second × USD 0.00000238/GB-seconds = USD 2.38

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.00000238/GB-seconds = USD 0.238

Additional information