Subscribes to bill files and stores the bill data in a specified Object Storage Service (OSS) bucket.
Operation description
Note the following when you call this operation:
You can subscribe to only one type of bill file at a time.
After you subscribe, the system starts to push the previous day's bill file daily. On the fourth day of each month, the system pushes the full bill file for the previous billing cycle. The monthly bill in PDF format for the previous month is also pushed on the fourth day of each month.
The generation of daily bill files may be delayed. A delayed bill file is pushed on the following day. This file may also include bill data that was delayed from the previous day. Pull the full data for the previous month at the beginning of each month.
The first time you subscribe to bills using OSS, you must grant the AliyunConsumeDump2OSSRole permission to the subscriber. If the authorization is revoked, the system stops pushing files. You must grant the permission again.
This subscription is equivalent to the "Data Storage" feature in the Expenses and Costs console. The subscriptions are synchronized.
When you subscribe to a folder in a bucket, make sure that the folder name meets the following requirements:
Do not use emojis. Use valid UTF-8 characters.
Use a forward slash (/) to separate paths and create subdirectories. Do not start a name with a forward slash (/) or a backslash (\). Do not use consecutive forward slashes (/).
Do not name a subdirectory "..".
The total length must be 1 to 254 characters.
File names:
BillingItemDetailForBillingPeriod (Bill details by billing item)
Format of daily pushed files:
UID_BillingItemDetail_YYYYMMDD. Example:169**_BillingItemDetail_20190310.Format of full files at the beginning of the next month:
UID_BillingItemDetail_YYYYMM. Example:169**_BillingItemDetail_201903.
InstanceDetailForBillingPeriod (Bill details by instance)
Format of daily pushed files:
UID_InstanceDetail_YYYYMMDD. Example:169**_InstanceDetail_20190310.Format of full files at the beginning of the next month:
UID_InstanceDetail_YYYYMM. Example:169**_InstanceDetail_201903.
InstanceDetailMonthly (Monthly bill summary by instance)
Format of daily pushed files:
UID_InstanceDetailMonthly_YYYYMM. Example:169**_InstanceDetailMonthly_201903. This file is updated daily with the full data from the beginning of the month to the current day. This process continues until the fourth day of the next month.
BillingItemDetailMonthly (Monthly bill summary by billing item)
Format of daily pushed files:
UID_BillingItemDetailMonthly_YYYYMM. Example:169**_BillingItemDetailMonthly_201903. This file is updated daily with the full data from the beginning of the month to the current day. This process continues until the fourth day of the next month.
SplitItemDetailDaily (Daily summary of split bills)
Format of daily pushed files:
UID_SplitItemDetailDaily_YYYYMM. Example:169**_SplitItemDetailDaily_201903. This file is updated daily with the full data from the beginning of the month to the current day. This process continues until the fourth day of the next month.
MonthBill (Monthly bill in PDF)
Format of monthly pushed files:
UID_MonthBill_YYYYMM. Example:169**_MonthBill_201903. The bill file for the previous month is pushed on the fourth day of each month.
Except for MonthBill files, which are in PDF format, all other files are in CSV format. If the number of data rows in a bill exceeds a specific threshold, the bill is split into multiple CSV files. These files are then merged and compressed into a ZIP file. The ZIP file uses the same file name format.
Try it now
Test RAM authorization
Action | Access level | Resource type | Condition key | Dependent action |
bss:ModifySubscribeToOSS | create | *All Resource
| None | None |
Request parameters
Parameter | Type | Required | Description | Example |
SubscribeBucket | string | Yes | The name of the OSS bucket where the subscribed bill files are stored. | xxxxxx-bucket |
SubscribeType | string | No | The subscription type. Valid values:
| BillingItemDetailForBillingPeriod |
MultAccountRelSubscribe | string | No | The type of bill to which you want to subscribe. This parameter is available only for multi-tier accounts. Valid values:
Default: MA. | MA |
BucketOwnerId | integer | No | The UID of the OSS bucket owner. This parameter is required only when a distributor subscribes to bills and saves them to an OSS bucket of a sub-account. In this case, the sub-account must be a sub-account of the distributor's account and granted the AliyunConsumeDump2OSSRole permission. Regular users do not need to specify this parameter. By default, the UID of the current account is used. | 12341324 |
BeginBillingCycle | string | No | The initial billing cycle from which bills are pushed. After you subscribe to the bills, the system automatically pushes the data from the initial billing cycle to the current time. This parameter is invalid for monthly bill subscriptions in PDF format. Historical data is not repushed. You can push data generated within the last year. | 2021-03 |
BucketPath | string | No | The specified folder in the bucket to which you subscribe. | testpath |
RowLimitPerFile | integer | No | The maximum number of rows in a single file. If a bill file exceeds this limit, it is split into multiple files. The files are then merged and compressed into a ZIP package. | 300000 |
UsingSsl | string | No | Specifies whether to use Secure Sockets Layer (SSL) to protect network communications. Valid values:
| true |
Response elements
Parameter | Type | Description | Example |
object | |||
Code | string | The status code. | Success |
Message | string | The error message. | Successful! |
RequestId | string | The request ID. | F61FCE4B-9B56-4FD9-A17E-****** |
Success | boolean | Indicates whether the request was successful. | true |
Examples
Success response
JSON format
{ "Code": "Success", "Message": "Successful!", "RequestId": "F61FCE4B-9B56-4FD9-A17E-******", "Success": true }Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.