Creating AnyCost Custom Adaptors
Follow these steps to create your AnyCost Adaptors and automate the flow of any cost data you can capture and send into the CloudZero platform.
What is an Adaptor?
An adaptor is a piece of code that automates retrieving cost data from a provider (example: New Relic, MongoDB, Databricks, etc.), translating that data to a common format for CloudZero ingestion, and writing that data to an S3 bucket. Once that bucket is setup via the CloudZero Billing Connection UI, CloudZero can then ingest that data into its platform.
Guidelines for creating a Custom Adaptor
Custom adaptors give you the freedom of creating your own code to format data from any provider. This data can then be ingested into the CloudZero platform for analysis and reporting. The development of these adaptors is largely up to you, but there are some very specific guidelines you must and should follow to ensure a smooth setup with the CloudZero infrastructure.
First, you must coordinate a way to receive cost data from your vendor - whether it's through APIs or generated exports.
Second, you must write the code that will translate that data into the CloudZero Common Bill Format (CBF). CBF is our standard file format for cost data ingestion, and it is the required format for successful ingestion of cost data into the CloudZero platform.
Design considerations when writing an Adaptor
- MUST: Convert provider cost data into the CloudZero Common Bill Format.
- MUST: Preserve information whenever possible.
- Example: if a provider gives you hourly data, don’t aggregate that data up to daily
- Example: if a provider gives you precise information about a charge, attempt to pass all of that information along into the Common Bill Format “CBF”
- MUST: Process data by month
- each report update in a given month is cumulative
- adaptors must include all billing data for a given month to date
- MUST: Ensure that
cost/discounted_costsum to the same total
- MUST: Write data to a sub-folder in the S3 Bucket and not place the cost folders into the root of the bucket
- SHOULD: Amortize to hourly
- data is viewable in the platform according to the lowest amortization supplied
- data supplied hourly can be aggregated to hourly and up (e.g. monthly)
- Note: this rule can be skipped for non-usage based line items (e.g. Taxes)
- SHOULD: Include taxes
- SHOULD: Handle Discounts and Committed Use
- SHOULD: Allow ingesting back data
- SHOULD: Minimize the frequency of drops without clear business value, there is a cost to processing new data drops; don’t drop data more often than the provider is giving significant new information
- SHOULD: Work with cost data using appropriate data types in your programming language (e.g. decimal.Decimal instead of float in Python)
- SHOULD: Don't populate the
bill/invoice_idfield until the provider has “closed” the invoice for the month that is being processed.
How do you DELETE a record or records?
CloudZero loads data cumulatively, so each data drop for any given billing period replaces what was previously in the CloudZero platform.
To delete or remove data from CloudZero for a given billing period, simply send us a new data drop for that period that contains all records, minus the ones you'd like to remove.
How do you DELETE an entire billing period?
To delete data for an entire billing period, send CloudZero an empty data drop, and because it replaces what is currently in the system, your data for that period will be removed.
Please Note: An empty data drop is one that contains a manifest file with the appropriate billing data information, and that points to a CSV with headers and no rows.
How do you UPDATE existing data?
To update data already in our system, simply send the edited data along with the rest of the data for that billing period. CloudZero replaces whatever is currently in the system with the data that is sent.
CloudZero loads cumulatively, so what you send for any particular billing period will entirely replace what is already there. Therefore, ensure the data drop for the rows you want to edit contains all the data for that billing period to avoid losing data.
Updated 8 months ago