Common Bill Format (CBF) Reference

Common Bill Format (CBF) is CloudZero's standard format for ingesting cost data from any source. When you connect a Custom Cost Data Source, your Adaptor converts your source data into CBF before sending it to CloudZero.

CBF works with both connection methods:

  • REST API: Send CBF data as JSON objects in the request body.
  • S3 Bucket: Write CBF data as gzipped CSV files (.csv.gz), encoded in UTF-8.

Mapping your data to CBF

Each record in your cost data maps to a set of CBF fields, organized into four categories:

CategoryWhen to use
RequiredEvery record needs a cost amount, a date, and a resource identifier (when using tags).
RecommendedAccount, service, line item type, and usage data give you richer breakdowns across CloudZero.
Optional costUse when your source distinguishes between cost types like amortized, discounted, or on-demand.
Optional dimensionAdd context like region, tags, Kubernetes metadata, and cloud provider.

Field reference

CBF columnTypeStatusDescription
cost/costnumberRequiredThe cost for this line item. Can be negative for discounts or credits.
Example: 12, -20
resource/idstringRequiredUniquely identifies the resource charged (required only when tags are included). See details.
Example: function/my-lambda
time/usage_startdatetimeRequiredThe hour during which the usage applies (aligned to start of hour, UTC).
Example: 2024-08-16T13:00:00Z
lineitem/typestringRecommendedCategory of line item. Defaults to Usage.
Example: Usage, Tax, Discount
resource/accountstringRecommendedThe most specific account or project for this resource.
Example: prod-001
resource/servicestringRecommendedService category the resource belongs to.
Example: Compute, Storage
usage/amountnumberRecommendedAmount consumed or used (for example, GB stored, seconds executed, credits consumed).
Example: 100, 3600
usage/unitsstringRecommendedUnits for usage/amount (relevant only when usage/amount is populated).
Example: GB, seconds
action/operationstringOptionalAction performed on the resource that generated the charge.
Example: RunInstances
action/usage_typestringOptionalSubdivision of resource/usage_family.
Example: USW2-BoxUsage:m5.xlarge
bill/invoice_idstringOptionalInvoice identifier. Do not populate until the invoice is closed.
Example: INV-2024-08
cost/amortized_costnumberOptionalCost after committed use (for example, Reserved Instances, Savings Plans) amortization. See details.
Example: 38
cost/discounted_amortized_costnumberOptionalCost after both discounts and committed use amortization.
Example: 34
cost/discounted_costnumberOptionalCost after discounts, credits, or negotiated pricing.
Example: 8
cost/on_demand_costnumberOptionalCost without any reductions applied. Useful for calculating savings rates.
Example: 24
k8s/clusterstringOptionalKubernetes cluster associated with the resource.
Example: my-cluster
k8s/deploymentstringOptionalKubernetes deployment associated with the resource.
Example: web-app
k8s/labelsstringOptionalKubernetes labels associated with the resource (JSON object).
Example: {"app": "frontend"}
k8s/namespacestringOptionalKubernetes namespace associated with the resource.
Example: default
lineitem/cloud_providerstringOptionalCloud provider for this line item (for multi-provider CBF files).
Example: AWS, Azure, Anthropic
lineitem/descriptionstringOptionalAdditional line item description.
Example: m5.xlarge on-demand
resource/regionstringOptionalRegion (default: no-region, free-form). Do not use global.
Example: us-east-1, eastus
resource/tag:<key>stringOptionalCustom resource attributes. Requires resource/id. See tag rules.
Example: resource/tag:team = platform
resource/tagsstringOptionalAlternative to resource/tag:<key>. All tags as a single JSON object with string keys and values. Requires resource/id. Pick one approach per file; if both are present, resource/tags takes precedence for overlapping keys.
Example: {"team": "Alpha", "environment": "production"}
resource/usage_familystringOptionalSubdivision of resource/service.
Example: EC2 - Other, Networking
time/usage_enddatetimeOptionalEnd of usage timespan (all charges are treated as occurring at time/usage_start).
Example: 2024-08-16T14:00:00Z
action/accountstringDeprecatedUse resource/account instead.
action/regionstringDeprecatedUse resource/region instead.

Field details

The following fields have specific rules or behaviors beyond what the field reference table covers.

lineitem/type

Supported values for lineitem/type:

ValueDescription
AdjustmentAn alteration to the bill to correct an error or rounding issue.
CommittedUsePurchaseAn upfront fee for a committed use subscription. Committed use covers any upfront or recurring payment that locks in a lower rate (for example, Reserved Instances, Savings Plans). The amortized_cost for this line item should be zero. Time columns should represent the span of the charge.
CommittedUseRecurringFeeA recurring fee for an active committed use subscription (for example, the monthly charge for a Reserved Instance).
CommittedUseVacancyUnused capacity from a committed use subscription (for example, a Reserved Instance with no matching usage).
CreditA negative value not associated with a specific Usage line item (for example, adjustments, refunds, rounding corrections).
DiscountA negative value associated with a Usage line item. Time, resource, and action fields should match the applicable Usage line item. Set discounted_cost to zero if the discount is fully accounted for in the discounted_cost of other Usage line items. You must still include discounted_cost even if the value is zero.
FeeA positive charge for which no other line item type applies.
PurchaseA one-time purchase or non-usage subscription (for example, marketplace software). Time columns should represent the span of applicability or the time of purchase.
SupportCharges for support or human services. Time columns should specify the start and end of the support contract.
TaxTax charges. Populate time, resource, and action fields only if the tax relates to specific Usage charges. Otherwise, leave those fields blank.
UsageA charge for the use of a cloud resource. This is the default if lineitem/type is not provided. The Real Cost cost type includes only Usage line items.

resource/id

Uniquely identifies the resource being charged. Required when resource/tag:<key> or resource/tags columns are included. Tags are time-independent, so CloudZero uses only the most recent set of tags for each unique resource ID.

CloudZero splits resource/id on the first colon (:) or forward slash (/) to extract two parts:

Example resource/idResource typeResource cloud local IDDropped
function/my-lambda-functionfunctionmy-lambda-function
a:b:cabc
a/b/c/d/eabc, d, e

Avoid using colons and forward slashes in resource/id values except to separate the type and name. Additional segments after the first separator are dropped.

resource/tag:<key>

Custom attributes associated with a resource.

  • Requires resource/id to be populated.
  • The <key> is case sensitive and can contain letters, numbers, and the characters _ . : / = + - @. No spaces, tabs, or returns.
    • Valid: resource/tag:team, resource/tag:Product-Type
    • Invalid: resource/tag:Team Name, resource/tag:Product&Dev
  • Tags appear as Tag Dimensions in CloudZero and can be used to filter or group costs.
  • You can include as many unique resource/tag:<key> columns as needed.
  • Only one value is stored per resource/tag:<key> per resource/id:
    • If multiple values exist, the value with the latest time/usage_start is used.
    • If all instances have identical time/usage_start dates, one is selected arbitrarily.
  • The latest value is retroactively applied to all historical data in CloudZero for that resource/id.

Alternatively, you can send all tags for a record as a single JSON object using the resource/tags column instead of individual resource/tag:<key> columns. Pick one approach per file. The same key rules apply.

{"team": "Alpha", "environment": "production"}

Cost columns

If you leave an optional cost column blank, CloudZero fills it using a fallback chain. A value of 0 is not treated as blank and is used as-is.

  • discounted_amortized_costamortized_costdiscounted_costcost
  • amortized_costcost
  • discounted_costcost
  • on_demand_costcost

The total value across all line items for cost, discounted_cost, amortized_cost, and discounted_amortized_cost should be the same. Each column represents a different way of distributing the same charges, not the addition or removal of charges. CloudZero does not reject mismatches, but inconsistent totals produce inaccurate cost breakdowns.

cost/amortized_cost

Amortization spreads an upfront payment across the resources and time periods that benefit from it. The cost/amortized_cost field represents the effective cost after committed use purchases (for example, Reserved Instances, Savings Plans, GCP CUDs) are amortized across the Usage line items they apply to.

CloudZero does not automatically amortize based on start and stop dates you send. The cost is applied on the start date.

Examples

These examples build on each other, starting with a basic bill and progressively adding cost columns to show how discounts and committed use purchases are represented.

Basic bill

A company purchases Compute from "Simple Cloud." They made an upfront committed use purchase that lowered the hourly rate by 50%. They also received a SpecialCompute discount for using a certain instance type, and an MVP Discount. The cost/cost column totals the bill for March: $105.30.

lineitem/typeresource/serviceresource/idtime/usage_startcost/cost
UsageComputeinstance-00002022-03-16T13:00:00Z12
UsageComputeinstance-00012022-03-16T13:00:00Z20
UsageComputeinstance-00022022-03-16T13:00:00Z15.3
PurchaseCommittedUsecommit-111-222-3332022-03-01T00:00:00Z90
DiscountSpecialComputespecial-010101012022-03-16T13:00:00Z-12
DiscountMVPDiscountmvp-aaa-123452022-03-01T00:00:00Z-20

Adding discounted cost

Adding cost/discounted_cost distributes the SpecialCompute discount across the individual instances. The SpecialCompute discount line item is zeroed out because it is already accounted for in the instance costs. The MVPDiscount is kept separate because it is unrelated to the Compute instances.

lineitem/typeresource/serviceresource/idtime/usage_startcost/costcost/discounted_cost
UsageComputeinstance-00002022-03-16T13:00:00Z128
UsageComputeinstance-00012022-03-16T13:00:00Z2016
UsageComputeinstance-00022022-03-16T13:00:00Z15.311.3
PurchaseCommittedUsecommit-111-222-3332022-03-01T00:00:00Z9090
DiscountSpecialComputespecial-010101012022-03-16T13:00:00Z-120
DiscountMVPDiscountmvp-aaa-123452022-03-01T00:00:00Z-20-20

Adding amortized cost

Adding cost/amortized_cost distributes the committed use purchase across the Compute instances it applies to. The purchase line item is zeroed out. The SpecialCompute discount is also zeroed out because the discount is already reflected in the reduced amortized costs of the instances. The total across cost/amortized_cost is $105.30.

lineitem/typeresource/serviceresource/idtime/usage_startcost/costcost/discounted_costcost/amortized_cost
UsageComputeinstance-00002022-03-16T13:00:00Z12838
UsageComputeinstance-00012022-03-16T13:00:00Z201646
UsageComputeinstance-00022022-03-16T13:00:00Z15.311.341.3
PurchaseCommittedUsecommit-111-222-3332022-03-01T00:00:00Z90900
DiscountSpecialComputespecial-010101012022-03-16T13:00:00Z-1200
DiscountMVPDiscountmvp-aaa-123452022-03-01T00:00:00Z-20-20-20

Adding Kubernetes columns

Adding Kubernetes columns provides context about which clusters, namespaces, and deployments are associated with each charge.

lineitem/typeresource/serviceresource/idtime/usage_startk8s/clusterk8s/namespacek8s/deploymentk8s/labelscost/cost
UsageComputeinstance-00002022-03-16T13:00:00Zmy-clusterdefaultweb-app{"app": "frontend", "env": "production"}12
UsageComputeinstance-00012022-03-16T13:00:00Zmy-clusterdefaultweb-app{"app": "frontend", "env": "production"}20
UsageComputeinstance-00022022-03-16T13:00:00Zmy-clusterdefaultworker-app{"app": "backend", "env": "production"}15.3
ℹ️

Have questions or feedback? Reach out to your account manager.