This topic describes how to view the billing details and usage details of MaxCompute and how to analyze bills in typical scenarios.

Billing management

Log on to the Alibaba Cloud Management Console. In the top navigation bar, click Expenses.
Note If you log on to the console as a RAM user, you must obtain the AliyunBSSFullAccess permission before you can use the console properly. For more information, see Grant permissions to a RAM role.

Billing details

  • Query daily bills.
    1. On the Bill page, click the Bills tab.
    2. Select MaxCompute from the Product Name drop-down list to view the daily bills of MaxCompute.
      Pay attention to the following configurations:
      • MaxCompute (Postpay) with Subscription Type set to Pay-As-You-Go: all pay-as-you-go bills generated for storage, computation, and Internet download traffic on the day after pay-as-you-go billing is enabled under the account.
      • Maxcompute (Prepay) with Subscription Type set to Pay-As-You-Go: all pay-as-you-go bills generated for storage and Internet download traffic on the day after subscription billing is enabled under the account.
      • Maxcompute (Prepay) with Subscription Type set to Subscription: all subscription bills generated for new purchases, configuration upgrade and downgrade, and renewal on the day under the account.
  • Query daily consumption details of pay-as-you-go billing items.
    1. On the Bill page, click the Details tab.
    2. Set Statistic Item to Billing Item, Statistic Period to By Day, and Subscription Type to Pay-As-You-Go.
    3. Select MaxCompute from the Product Name drop-down list to view the daily bills of each billing item.**
      Pay attention to the following configurations:
      • Instance ID: corresponds to a MaxCompute project. Bills in pay-as-you-go mode are generated by project. A bill is generated for each billing item each day.
      • Billing Item: includes storage, computation, and Internet download traffic.
      • Usage:
        The following part describes how to calculate the usage of each billing item:
        • Storage: the storage space used for the project on the day divided by 24.
        • Internet download traffic: the total data downloaded over the Internet for the project on the day.
        • SQL task computing: the total input data size of SQL standard tasks that were successfully executed for the project on the day multiplied by SQL complexity.
        • SQL external table computing: the total input data size of SQL tasks that were successfully executed for calculating external tables for the project on the day.
        • Developer SQL task computing: the total input data size of SQL tasks that were successfully executed for the project that uses developer resources on the day.
        • MapReduce task computing: the computation hours used to complete MapReduce tasks for the project on the day.
        • Interactive analysis task computing: the total input data size of interactive analysis tasks (Lightning) that were successfully executed for the project on the day.
        • Spark task computing: the computation hours used to complete Spark tasks that were successfully executed for the project on the day.

You can set Statistic Item and Statistic Period to different values to view billing details from different dimensions. You can also click Export Billing Overview (CSV) in the upper-right corner to download the bills to your computer and analyze the bills in an Excel file. However, the billing details do not provide the consumption amount of a single task. To view the consumption amount of a single task, download usage records to obtain the original metering information for calculating the consumption amount of a single task.

Usage records

Download usage records

Go to the Usage Record page to view daily resource usage and how fees are calculated. That is, the storage fee each day and which tasks generated the fee.
Set the following parameters:
  • Product: the service for which you want to download usage records. Select MaxCompute (Pay-As-You-Go).
  • Billing Method:
    • MaxCompute(Postpay): indicates the pay-as-you-go billing method.
    • ODPSDataPlus: indicates the subscription billing method.
  • Time Period: the time range to query. You can specify the start time and end time of the bills you want to view.

    If a task spans two days, for example, a task starts on December 1 and ends on December 2, you must set December 1 as the start time. Otherwise, you cannot find the task in the downloaded usage records. However, the consumption record can only be found in the bill of December 2.

Use usage records

After you export usage records to your computer as a CSV file, open the file to view detailed information.
The CSV file includes the following table headers:
ProjectId, MeteringId, MeteringType, Storage, EndTime, SQLInput(Byte), SQLComplexity, UploadEx, DownloadEx(Byte), MRCompute(Core*Second), InputOTS(Byte), InputOSS(Byte), StartTime, SpecificationType, DataWorksNodeID
The usage records allow you to perform the following operations:
  • View the instance ID of each SQL or MapReduce task and run the following command to view details about the task, as shown in the following example:
    odps@ odps_test>desc instance 2016070102275442go3xxxxxx;
    ID 2016070102275442go3xxxxxx
    Owner ALIYUN$***@aliyun-inner.com
    StartTime 2016-07-01 10:27:54 
    EndTime 2016-07-01 10:28:16
    Status Terminated 
    console_query_task_1467340078684 Success 
    Query select count(*) from src where ds='20160628';
    Note You can also view the execution information of a specific task by checking the TASKS_HISTORY and TUNNELS_HISTORY views of the MaxCompute Information_Schema service. However, the views only provide task execution information for the last 15 days.
  • View the original billing information of each SQL or MapReduce task and calculate the fees of the task by using the formula provided in Computing pricing. Examples:
    • Calculate the costs of a standard SQL task. ComputationSql in the MeteringType column indicates an SQL standard task. Use the following formula to calculate the computing costs of a standard SQL task: Input data size (GB) × SQL complexity × SQL unit price.
    • Calculate the costs of computing external tables, such as external Tablestore and OSS tables. Use the value of InputOTS(Byte) or InputOSS(Byte) in the CSV file as the data input size of the external table task. The fee of an SQL computing job that involves external tables is calculated by using the following formula: Fee of an SQL computing job = Input data size × SQL complexity × Unit price for SQL computing that involves external tables.

      The unit price for an SQL computing job that involves external tables is USD 0.0044/(GB × Complexity). Here, the complexity coefficient is 1.

    • Calculate the costs of a MapReduce task. Query the resource and time consumed by the MapReduce computing task in the MRCompute(Core*Second) column.

Bill analysis in typical scenarios

  • The fee surge is beyond my expectations.
    If your fee surges in one or a few days but the increase is not caused by business growth, perform the following steps to analyze the causes:
    1. Analyze projects that generate high charges. On the Bill page, click the Details tab. Set Statistic Item to Instance and Statistic Period to By Day. Find the projects indicated by Instance ID that generate high charges. If the consumption amount of a project is not as expected, analyze the project.
    2. Analyze billing items that generate high charges. On the Bill page, click the Details tab. Set Statistic Item to Billing Item and Statistic Period to By Day. Find the billing items that generate high charges. You can specify a project based on Instance ID and analyze its billing items that generate high charges.**
    3. Analyze computing tasks that generate high charges. If the preceding analysis indicates that the costs of SQL computing tasks surge, you can choose Bill > Usage Record and download usage records. Then, you can analyze the records where MeteringType is set to ComputationSql. Sort the expenses of SQL tasks, and check whether the expense of an SQL task is higher than expected or whether a large number of SQL tasks exist. The expense of an SQL task is calculated by using the following formula: Input data size (bytes)/1024/1024/1024 × SQL complexity × SQL unit price. If the expense of an SQL task is higher than expected, we recommend that you check the ID of the corresponding DataWorks node.
      • If such an ID is available, view the node execution details in the DataWorks console.
      • If such an ID is unavailable, the task is not initiated by a DataWorks scheduling node. You can view specific execution information provided in TASKS_HISTORY based on the SQL billing code indicated by Instance ID.
        select operation_text from information_schema.tasks_history where ds='Partition corresponding to the date on which the task is executed' and inst_id='SQL billing code indicated by Instance ID';
  • Are my data uploads and downloads billed?
    You can check charges generated from data uploads and downloads by completing the following steps:
    1. Export usage records as a CSV file, and analyze the billing details for data downloads. DownloadEx indicates the Internet download billing item.
    2. In the case that you find a record for a download fee of 0.036 GB (which is equal to 38,199,736 bytes), you can calculate the charges based on Download pricing(Pay-As-You-Go) by using the following formula: (38,199,736 bytes/1024/1024/1024) × USD 0.1166/GB = USD 0.004.

    3. Optimize data downloads.

      You can also check whether the service that is configured for your tunnel is billed due to Internet access. For more information, see Configure endpoints.

      For example, if you are located in Suzhou and you select the China (Shanghai) region, you can download data to your VM through an ECS instance in the China (Shanghai) region, and then use your subscription ECS instance to download the data.

  • How is storage of less than one day billed?
    1. Export usage records as a CSV file, and analyze the billing details for storage.
    2. View Storage in the MeteringType column. A total of 333,507,833,900 bytes of data is stored for the alian project. The data was uploaded at 8:00. Therefore, storage was billed from 9:07 and a total of 15 hours are charged for storage.
      Note If the billing cycle is one day, the billing stops at the end of each day. Therefore, the last record is not included in the bill of that day.
      The average storage over the last 24 hours is calculated based on Storage pricing (pay-as-you-go).
      --Calculate the average storage.
      333507833900 Byte*15/1024/1024/1024/24=194.127109076362103GB
      
      --The data size is 194 GB. The storage unit price for the range "greater than 1 GB and less than 100 GB" is USD 0.0028/GB/day. The storage unit price for the range "greater than 100 GB and less than 1 TB" is USD 0.0014/GB/day. Therefore, the storage fee per day is calculated by using the following formula with four decimal places:
      100 GB × USD 0.0028/GB/day + (194.127109076362103 GB - 100 GB) × USD 0.0014/GB/day = USD 0.4118/day