Sending AnyCost Stream Data to CloudZero (Beta)

The AnyCost Stream feature is in beta. Contact your CloudZero representative to request access.

An AnyCost Stream Adaptor sends Common Bill Format (CBF) data to the CloudZero /v2/connections/billing/anycost/{connection_id}/billing_drops API. This process requires mapping CBF data into a JSON request body.

To send AnyCost Stream data to CloudZero, complete the following steps:

  1. Find the AnyCost Stream connection ID.
  2. Send billing data to the AnyCost Stream connection Billing Drop API.

Step 1: Find the AnyCost Stream Connection ID

After you create the AnyCost Stream connection in the CloudZero UI but before you author the Adaptor code to send billing data to the CloudZero API, you must find the connection ID.

Navigate to your CloudZero organization's Settings and select the AnyCost Stream connection from the Billing Connections table.

In the Custom Connection Details page, copy the Connection ID. It will look something like this: 1234abcd-1234-abcd-1234-abcd1234efgh

Copy the AnyCost Stream Connection ID

Step 2: Send Billing Data to the AnyCost Stream Connection Billing Drop API

Because AnyCost Stream billing data is sent to CloudZero through the API, your Adaptor must map the CBF data to the required JSON request body parameters.

For example, in the CBF your Adaptor generates, the lineitem/id column corresponds to the request body parameter lineitem/id.

For a full list of data file columns, see the CBF documentation.

For example, suppose your CBF data includes the following heading and row:

lineitem/type,resource/service,resource/id,time/usage_start,cost/cost
Usage,Compute,instance-0000,2024-08-16T13:00:00Z,12

Your JSON request body should include the following object in the data array:

    {
      "lineitem/type": "Usage",
      "time/usage_start": "2024-08-16T13:00:00Z",
      "resource/id": "instance-0000",
      "resource/service": "Compute",
      "cost/cost": "12"
    }

Make sure the Adaptor adds an object to the data array for each row in the CBF.

In the JSON body, include the month parameter, which is an ISO-8601 formatted datetime.

📘

Overwriting AnyCost Stream Adaptor Billing Data

Be aware that any existing records associated with the AnyCost Stream Adaptor in the specified month will be overwritten by the records in the request body.

For example, if month is set to 2024-08-16T14:27:46+00:00, all billing data associated with this AnyCost Stream adaptor in August 2024 will be replaced by the records in the request body.

We recommend that you include all records for a single month in a single request.

After all your cost data is added to the data array, the payload in the example would look as follows:

{
  "month": "2024-08-16T14:27:46+00:00",
  "data": [
    {
      "lineitem/type": "Usage",
      "time/usage_start": "2024-08-16T13:00:00Z",
      "resource/id": "instance-0000",
      "resource/service": "Compute",
      "cost/cost": "12"
    }
  ]
}

After you've constructed the request body, see the API Reference for instructions to send the POST request to the AnyCost Stream Billing Drops API.

📘

AnyCost Stream API Size Limit

The AnyCost Stream Billing Drops API currently limits the size of the uncompressed JSON body to 5MB.