Expenditure Data Storage
You can enable expenditure data storage by creating a bucket on Object Storage Service (OBS). Huawei Cloud will synchronize your bills to the designated bucket on OBS.
Enabling Bill Subscription
- Create a bucket on OBS. For details, see Creating a Bucket.
- Go to the Billing Center.
- Go to the Data Storage page.
- Specify a bucket name.
If the bucket becomes invalid, expenditure data storage is automatically disabled.
- Click Verify.
If the verification is successful, all available bills are displayed.
- Select the bills that you want to export and click OK.
Once authorized and verified, the files for your selected bills will be synchronized to your bucket on OBS every day.
- Click Get Code.
- Enter the received SMS verification code and click OK.
You can click Close next to the object storage name to close expenditure data storage.
Downloading Subscribed Bills
- Choose Service List > Storage > Object Storage Service.
- Click the bucket name link.
- In the navigation pane, choose Objects. You can view all files of the subscribed bills that have been exported.
- Bills of the same type are sorted in descending order.
- You can search for bills by bill name prefix. For example, you can enter Spendings(ByResource)_201906 in the search box to view all resource bill files in June 2019.
- If you are using monthly settlement, daily data is provided as an estimate only. You are advised to obtain accurate bill files for each month on the third day of the following month.
After expenditure data storage is enabled, data listed in Table 1 will be automatically exported based on your selection.
Table 1 Exported bills Bill
Billing Cycle
Data Scope
Filename Identifier
Resource expenditures
Every day
Resource expenditure data of the previous day
Resource_Expenditures_YYYYMMDD
Resource bill
Every day
All resource bill data of the current month (excluding the current day)
Spendings (ByResource)_YYYYMMDD
The third day of each month
Resource data of the last month (YYYYMMDD in the file name indicates the last day of the last month)
Spendings (ByResource)_YYYYMMDD
- Select the bill you want to download and click Download in the Operation column.
Follow-up Operations
If you want to download subscribed bills every day, run the script below. After the script is executed, the subscribed bills will be automatically downloaded.

The code example below is for reference only. You can develop the code as needed.
#!/usr/bin/python # -*- coding:utf-8 -*- import string,os,sys,datetime import commands import json #get date date = datetime.date.today()-datetime.timedelta(1) str_date = date.strftime("%Y%m%d") AK = '' SK = '' server = '' bucketName = '' #prefix="Consumedetails_"+str_date prefix="Resource_Expenditures_"+str_date print prefix from com.obs.client.obs_client import ObsClient # Construct an obs client instance with your account for accessing OBS obsClient = ObsClient(access_key_id=AK, secret_access_key=SK, server=server) #find which billing resp=obsClient.listObjects(bucketName,prefix) #billing name objectKey=resp.body.contents[0].key localFileDir='/opt/huawei/zcm/data/'+objectKey # Download the object to a file print('Downloading an object to dir:' + localFileDir + '\n') obsClient.getObject(bucketName, objectKey, downloadPath=localFileDir)
Parameter description:
- AK: access key ID on OBS. One AK maps to only one user but one user can have multiple AKs. OBS identifies users via access key IDs. For details about how to create and obtain the AK and SK, see Obtaining Access Keys (AK and SK).
- SK: secret access key used to access OBS. Authentication information is generated based on SKs and request headers. Each AK maps onto a unique SK.
- server: domain name, representing the bucket's Internet address. It is used for direct access to buckets in cases like cloud application development and data sharing. You can obtain its value from the part marked with ① in Figure 1.
- bucketName: name of the bucket used to store subscribed bills. You can obtain its value from the part marked with ② in Figure 1.
- prefix: bills that need to be automatically downloaded.
- "Resource_Expenditures_": resource expenditure records
- "Spendings (ByResource)_": resource bill
- localFileDir: local directory for storing downloaded bill files.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot