This topic describes the monthly free tier, billable items, and billing methods for Function Compute.
Monthly free tier
Function Compute provides you with the monthly free tier. Your Alibaba Cloud account and RAM user share the monthly free tier that includes requests and duration. Your monthly free tier does not accrue. At 00:00 on the first day of each calendar month, your free tier is cleared and recalculated. The following resources are included in the monthly free tier:
- Requests: the first million requests each month are free.
- Duration: The first 400,000 CU-second of resource usage for function instances each month is free.
|Requests||A request is recorded each time a function is triggered to execute.
Note If a function is invoked but fails to execute due to a system error, the invocation is not recorded.
|1,000,000 requests||USD 0.2/1,000,000 requests||None|
|Resource usage of function instances||Computing power (CU) × duration (seconds).
Note Duration is calculated differently for reserved instances and pay-as-you-go instances. For more information, see Calculation of function duration for instances.
The resource consumption of one function instance with 1 CU in one second.
For more information about the billing methods of Function Compute, see Overview.
|Data transfer to the Internet||Data transfer within a function||The traffic generated when an Internet request is triggered.||GB||USD 0.117/GB||None|
|Function response||The traffic generated when a function is invoked over the Internet and returns a response.||GB||USD 0.117/GB||Advanced technology and continuing discounts|
|Back-to-origin data transfer||The CDN back-to-origin traffic generated with Function Compute as the CDN origin.||GB||USD 0.117/GB|
- Computing power
- The computing power of function instances is directly proportional to the size of allocated memory. To simplify billing, Function Compute uses capacity unit (CU) that is equivalent to the memory size in GB. One CU equals 1 GB.
- Function Compute provides compute capabilities that can match those of Elastic Compute Service (ECS) and Alibaba Cloud Container Service for Kubernetes.
- Function Compute supports instance concurrency. Reused resources are billed based on CU-second and are not billed for each reuse.
- Network traffic
- Data transfer within the internal network is not billed.
- Data transfer from the Internet is not billed. For example, you are not billed when functions in Function Compute read or download files from the Internet. However, writing files to storage on the Internet may generate billable traffic.
Total Function Compute cost = requests cost + resource usage cost for function instances + cost of data transfer to the Internet
- Requests cost = (number of requests - monthly free tier) × unit price per request
- Resource usage cost for function instances = (computing power for function instances
× duration) × unit price for resource usage
Note In pay-as-you-go mode, the unit price for resource usage for function instances is USD 0.000016384/CU-second. In subscription mode, the unit price is USD 12.16/CU-second. For more information about billing methods, see Overview.
For more information about how to calculate the duration, see Calculation of function duration for instances.
- Cost of data transfer to the Internet = data traffic within a function × traffic unit price (USD 0.117/GB) + traffic generated from responses to requests × traffic unit price (USD 0.117/GB) + back-to-origin data transfer × traffic unit price (USD 0.117/GB)
Calculation of function duration for instances
Function compute supports pay-as-you-go instances and reserved instances. The function duration for these instance types is calculated differently.
- Pay-as-you-go instances
Function Compute automatically creates and releases pay-as-you-go instances. For pay-as-you-go instances, billing is based on the function duration on the instance. Billing starts when a request executes a function and ends when the request has finished running. A pay-as-you-go instance can process one request or multiple requests concurrently. For more information, see Instance concurrency.
- Duration for one instance that processes one request
When a single request is processed by a pay-as-you-go instance, the duration is calculated from the time the request arrives at the instance to the time the request has finished running.
- Duration for one instance that concurrently processes multiple requests
When multiple requests are processed concurrently by a pay-as-you-go instance, the duration is calculated from the time the first request arrives at the instance to the time the last request has finished running. Concurrent processing reuses resources and reduces costs.
- For pay-as-you-go flexible instances, the billing granularity is 100 milliseconds. For example, if the actual duration for a function instance is 1010 milliseconds, the billable duration is 1100 milliseconds.
- For pay-as-you-go performance instances, the billing granularity is one minute. If the total billable duration is less than one minute, the duration is billed as one minute.
- Duration for one instance that processes one request
- Reserved instances
Reserved instances are allocated, released, and managed by you. For more information, see Reserved instances. For a reserved instance, billing is based on the running duration of the instance. Billing starts when the reserved instance is started and ends when the instance is released. Reserved instances that have not been released are billable even when they are idle.Note
- For reserved flexible instances in pay-as-you-go mode, the billing granularity is one second. If the total billable duration is less than one minute, the duration is billed as one minute. For example, a reserved instance that runs for 51 seconds has a billable duration of 1 minute. However, a reserved instance that runs for 61 seconds has a billable duration of 61 seconds.
- For reserved performance instances in pay-as-you-go mode, the billing granularity is one minute. If the total billable duration is less than one minute, the duration is billed as one minute.
The following examples show how monthly cost is calculated based on the pay-as-you-go rate.
|Memory||Requests||Duration per request||Network bandwidth||Monthly cost|
|512 MB||3 million||1 second||0||USD 18.4224 = (512 MB/1024 × 3,000,000 requests × 1 second - 400,000 CU-second) × USD 0.000016384/CU-second + (3,000,000 requests - 1,000,000 requests) × USD 0.2/1,000,000 requests|
|128 MB||30 million||200 milliseconds||0||USD 11.5344 = (128 MB/1024 × 30,000,000 requests × 0.2 seconds - 400,000 CU-second) × USD 0.000016384/CU-second + (30,000,000 requests - 1,000,000 requests) × USD 0.2/1,000,000 requests|
|128 MB||25 million||200 milliseconds||0||USD 8.4864 = (128 MB/1024 × 25,000,000 requests × 0.2 seconds - 400,000 CU-second) × USD 0.000016384/CU-second + (25,000,000 requests - 1,000,000 requests) × USD 0.2/1,000,000 requests|
|448 MB||5 million||500 milliseconds||0||USD 12.1664 = (448 MB/1024 × 5,000,000 requests × 0.5 seconds - 400,000 CU-second) × USD 0.000016384/CU-second + (5,000,000 requests - 1,000,000 requests) × USD 0.2/1,000,000 requests|
|1024 MB||2.5 million||1 second||0||USD 34.7064 = (1024 MB/1024 × 2,500,000 requests × 1 second - 400,000 CU-second) × USD 0.000016384/CU-second + (2,500,000 requests - 1,000,000 requests) × USD 0.2/1,000,000 requests|