Help Center/ FunctionGraph/ Billing/ Billing Examples
Updated on 2024-09-09 GMT+08:00

Billing Examples

Billing Scenario I

A user created functions A, B, and C in April, as shown in Table 1. Assume that the total number of executions of these three functions in April was 2 million, 100,000, and 100,000. How much was the user billed for the three functions in April?

Table 1 Function details

Function

Description

Function A (not using reserved instances)

Created on April 5, 2023. Assume that the memory of function A is 512 MB and the execution duration is 500 ms.

Function B (using reserved instances and idle mode disabled)

Created on April 18, 2023. Assume that the memory of function B is 128 MB and the execution time is 10s. If function B was deleted on April 30, 2023, the running duration of function B is 12 days.

Function C (using reserved instances and idle mode enabled)

Created on April 20, 2023. Assume that the memory of function C is 128 MB and the execution time is 5s. If function C was deleted on April 30, 2023, the running duration of function C is 10 days.

Billing Analysis (Scenario I)

Functions A, B, and C are billed separately since they use different types of instances. For details, see Table 2.

Table 2 Billing details

Billing Item

Billing Details

Price for requests

(2 million requests + 100,000 requests + 100,000 requests – 1 million requests) × $0.2 USD/1 million requests = $0.24 USD

Price for execution duration

Total execution duration of function A: 512 MB/1024 MB × (500 ms/1000 ms) × 2 million requests = 500,000 GB-seconds.

Total execution duration of function B: 128 MB/1024 MB × (12 × 24 × 60 × 60) = 129,600 GB-seconds.

The execution duration of function C is divided into two parts:

  • Execution duration: 128 MB/1024 MB × 5s × 100,000 requests = 62,500 GB-seconds
  • Idle duration: 128 MB/1024 MB × (10 × 24 × 60 × 60 – 5s × 100,000 requests) = 45,500 GB-seconds

Price for execution duration of functions A, B, and C: $0.00001667 USD/GB-second × (500,000 GB-seconds + 129,600 GB-seconds + 62,500 GB-seconds – 400,000 GB-seconds) + 45,500 GB-seconds × $0.000005556/GB-second = $5.122105

Total

Price for requests + Price for execution duration = $0.24 USD + $5.122105 = $5.362105 ≈ $5.36