CostFormation Language Reference

Conditions

This sections lists the supported conditions.

And

This condition evaluates a list of conditions as a logical And operation.

  - And:
    - <Condition 1>
    - <Condition 2>
    ...
    - <Condition N>

This condition evaluates to True only if all conditions evaluate to True. If a single condition in the list evaluates to False, then the entire condition evaluates to False.

BeginsWith

This condition checks whether the source value begins with the any of the specified strings. This condition can optionally specify its own source properties.

  - BeginsWith: <Value>
    <Source Properties>

Or

  - BeginsWith:
      - <Value 1>
      - <Value 2>
      ...
      - <Value N>
    <Source Properties>

Contains

This condition checks whether the source value contains any of the specified strings. This condition can optionally specify its own source properties.

  - Contains: <Value>
    <Source Properties>

Or

  - Contains:
      - <Value 1>
      - <Value 2>
      ...
      - <Value N>
    <Source Properties>

Equals

This condition checks whether the source value equals any of the specified strings. This condition can optionally specify its own source properties.

  - Equals: <Value>
    <Source Properties>

Or

  - Equals:
      - <Value 1>
      - <Value 2>
      ...
      - <Value N>
    <Source Properties>

HasValue

This condition checks whether the source value has an actual value or not. This condition can optionally specify its own source properties.

  - HasValue: <True|False>
    <Source Properties>

If HasValue is set to True, then the condition evaluates to True if the source has a value. If HasValue is False, then the condition evaluates to False if the source does not have a value.

Not

This condition evaluates the list of conditions as a logical Or and then negates the result.

  - Not:
    - <Condition 1>
    - <Condition 2>
    ...
    - <Condition N>

This condition evaluates to True only if all conditions evaluate to False. If a single condition in the list evaluates to True, then the entire condition evaluates to False.

Or

This condition evaluates the list of conditions as a logical Or.

  - Or:
    - <Condition 1>
    - <Condition 2>
    ...
    - <Condition N>

This condition evaluates to True if any of the list of conditions evaluate to True. If all conditions in the list evaluate to False, then the entire condition evaluates to False.

Sources

This section describe the available sources that can be referenced when building Custom Dimensions with CostFormation. The sources are broken down by types of sources (i.e. sources direct from billing data, resource tags, etc). Each table shows the Source ID which is the ID of the source that would be used in the Custom Dimension definition.

📘

Dimensions in the Explorer and Views

Not all source dimensions listed in this section are available in the Explorer or Views and some are located with a slightly different name than their ID. Check the Name in Explorer/Views column to see which source IDs are visible in the Explorer and Views and under which name.

Core Cloud Provider Dimensions

These dimensions are sourced directly from billing data from your cloud provider.

Source IDName in Explorer/ViewsDescription
AccountAccountElements consist of the IDs for any cloud account you have connected to CloudZero (for example: Azure subscription ID, GCP project ID, AWS account ID).
CloudProviderCloud ProviderElements consist of the cloud providers supported by CloudZero (for example: AWS, GCP).
InvoiceIdNot AvailableElements consist of the corresponding invoice ID of the charges.
LineItemTypeNot AvailableElements consist of the type of charge for a given billing line item.
OperationNot AvailableElements consist of the specific cloud provider operation covered by the billing line item.
PayerAccountNot AvailableElements consist of the Management Account associated with the charges.
PricingTermNot AvailableElements consist of how charges are priced (for example: on-demand, reserved.)
RegionRegionElements consist of the cloud region where the billed resource is located.
ResourceNot AvailableElement is the CloudZero Resource Name (CZRN) of the resource. The CZRN is a unique identifier formed from cloud provider metadata such as resource name, account, and region.

To avoid performance issues in the Explorer, we recommend using CZ:Defined:ResourceSummaryDisplay as a source in CostFormation instead, which groups logically related resources together (such as EKS clusters) and does not include individual instance IDs.

However, if you must match resources based on IDs, use CZ:Defined:ResourceDisplay instead because it uses the native resource ID instead of the CZRN and therefore aligns with the resource values shown in the CloudZero UI.
RequestTypeNot AvailableElements consist of incoming request type, such as from AWS CloudFront.
ServiceNot availableElements consist of codes for the cloud provider service type. To find the service code, filter by Service in the Explorer and look at the URL. Alternatively, you can use the CZ:Defined:ServiceDisplay source instead, which aligns with the service values shown in the CloudZero UI.
TransferTypeNot AvailableElements consist of the type of data transfer (for example: outbound, intra-region).
UsageFamilyUsage FamilyElements consist of the cloud service charges.
UsageTypeNot AvailableElements consist of the usage details of the billing line item in the cloud provider.

Additional Cloud Provider Dimensions

The following dimensions are defined by CloudZero, based on billing data from your cloud provider. They are available in the Explorer and Views.

Source IDName in Explorer/Views (Found under Cloud Provider Dimensions)Description
CZ:Defined:BillingLineItemBilling Line ItemElements consist of categories of billing line item (for example: Usage, Support).
CZ:Defined:CategoryService CategoryElements consist of the different categories of services similar to what you would see in your cloud provider console (for example: Networking, Compute).
CZ:Defined:ElasticityElasticityElements include two types of spend: Storage and Variable Costs.
CZ:Defined:InstanceTypeInstance TypeElements are grouped by a sub-section of the UsageType name and filtered to show costs specifically related to the type, size, and family of a resource (for example: AmazonEC2, ElasticMapReduce).
CZ:Defined:NetworkingCategoryNetworking CategoryElements consist of the major types of networking spend (for example: VPC Endpoints, Data Transfer).
CZ:Defined:NetworkingSubCategoryNetworking Sub-CategoryElements are a deeper breakdown of networking-related costs (for example: VPC Endpoint (Hours), S3 Outbound).
CZ:Defined:PaymentOptionPayment OptionElements consist of different payment types (for example: Reservation, Discount) grouped based on LineItemType, UsageFamily, and UsageType.
CZ:Defined:ResourceDisplayNot AvailableSame as Resource, but uses native resource IDs instead of CZRNs and therefore aligns with the resource values shown in the CloudZero UI.

To avoid performance issues in the Explorer, we recommend using CZ:Defined:ResourceSummaryDisplay instead, which groups logically related resources (such as EKS clusters) and does not include individual instance IDs.
CZ:Defined:ResourceNameOnlyNot AvailableDeprecated. Use CZ:Defined:ResourceSummaryDisplay instead.
CZ:Defined:ResourceSummaryDisplayResource SummaryBy default, the base of the hierarchy when a user drills down in the Explorer. This dimension groups resources that tend to be copious and are logically related (such as EKS clusters) into elements, omitting individual instance IDs. The dimension preserves standalone resources (such as database servers or lambdas) as individual elements. Use this dimension instead of Resource or CZ:Defined:ResourceDisplay to prevent performance issues in the Explorer.
CZ:Defined:ResourceSummaryIDNot AvailableSame as CZ:Defined:ResourceSummaryDisplay, but uses CZRNs instead of the native resource IDs. When trying to match against resources in CostFormation, use CZ:Defined:ResourceSummaryDisplay instead, which aligns with the resource values shown in the CloudZero UI.
CZ:Defined:ResourceTypeResource TypeElements consist of resource types for each cloud provider service (for example: BigQuery: job, S3: bucket).
CZ:Defined:ServiceDisplayServiceSame as Service, but aligns with the display values shown in the CloudZero UI.
CZ:Defined:ServiceDetailService DetailA normalized version of the more detailed data stored in UsageType and/or Operation. This dimension selects whichever data is more relevant for each Service in terms of UsageFamily and then optimizes it.
CZ:Defined:TaggableVsUntaggableTaggable vs. UntaggableElements consist of taggable resources and types of untaggable resources (for example: Taggable, Untaggable - Service Charges).

📘

Best Practices for Sourcing Resource Dimensions

CloudZero supports multiple types of dimensions related to resources and resource IDs:

If you are writing CostFormation to match against resources, CZ:Defined:ResourceSummaryDisplay is almost always the best choice. This dimension uses the native resource IDs shown in the CloudZero UI, and it improves Explorer performance by grouping logically related resources together instead of enumerating individual instance IDs.

Tag Dimensions

The CloudZero platform inspects all of your cloud resources and compiles the list of tags, both AWS tags and user tags, and exposes them as Dimensions that can be used throughout the platform. All tags are available in the Explorer and Views.

Source IDName in Explorer/Views (Found under Tags)Description
Tag:Tag -> <Tag Name>Elements consist of the different values for the given tag.

Kubernetes Dimensions

Some dimensions are derived from dynamic data that is discovered through Kubernetes integrations. All Kubernetes dimensions are available in the Explorer and Views.

Source IDName in Explorer/Views (Found under Kubernetes)Description
K8s:ClusterClusterElements consist of the Kubernetes cluster names.
K8s:NamespaceNamespaceElements consist of the Kubernetes namespace across all Kubernetes clusters.
K8s:WorkloadWorkloadElements consist of the deployed workload resources in any of your Kubernetes clusters.
K8s:Label:<Label Name>Label > Label NameThe CloudZero Agent for Kubernetes supports labels for Pods. It offers beta support for labels and annotations in Pods, Deployments, StatefulSets, DaemonSets, Jobs, CronJobs, Nodes, and Namespaces.

Elements are formatted in CostFormation as follows:

Labels for Pods: K8s:Label:<label-key>: <label-value>
(Example: K8s:Label:myKey: myValue)

Labels for Other Supported Resources: K8s:Label:<resource-type>:<label-key>: <label-value>
(Example: K8s:Label:node:myKey: myValue)

Annotations for Pods: K8s:Label:annotation:<label-key>: <label-value>
(Example: K8s:Label:annotation:myKey: myValue)

Annotations for Other Supported Resources: K8s:Label:<resource-type>:annotation:<label-key>: <label-value>
(Example: K8s:Label:node:annotation:myKey: myValue)

Custom Dimensions

All Custom Dimensions are available in the Explorer and Views.

Source IDName in Explorer/ViewsDescription
User:Defined:<Dimension ID><Dimension Name>Elements are grouped according to the logic in the CostFormation definition.

Transforms

Lower

This transform will lowercase all of the letters in the source value. This transform has no parameters.

  - Type: Lower

Example:

Source ValueTransform Result
ProductionResource 1productionresource 1

Normalize

This transform will lowercase all of the letters in a the source value and will also convert any instance of the characters .,/#!$%^&*;:=_ ~()\' to a dash (-). This transform has no parameters.

  - Type: Normalize

Example:

Source ValueTransform Result
Production/Resources#4561production-resources-4561

Split

This transform will split the source value into a list of substrings using a specified delimiter. It will then extract the substring based on the specified index. The index is 1 based.

  - Type: Split
    Delimiter: <delimiter>
    Index: <1 based index>

Example:

ParametersSource ValueTransform Result
Delimiter: '-'
Index: 1
eu-west-1eu