VS Code Extension

The CloudZero CostFormation Toolkit for VS Code lets you write, validate, and publish Dimension definitions from your editor. The extension provides autocompletion for all YAML constructs, validates your definitions against the CloudZero platform as you work, and publishes changes without leaving VS Code.

💡

Prefer a visual editor? Most users build Dimensions in Dimension Studio with no code required. The VS Code extension is for teams that prefer managing Dimensions as code in their own editor.

Set up the extension

What you need

Install the extension

  1. Open VS Code.
  2. Select the Extensions icon in the Activity Bar (or press ⇧⌘X / Ctrl+Shift+X).
  3. Search the marketplace for CloudZero.
  4. Select CloudZero CostFormation Toolkit from the results, then select Install.
Search for CloudZero in the VS Code marketplace

Use the extension

Each time you work with your Dimensions, the workflow follows seven steps:

  1. Log in to CloudZero
  2. Download your definitions
  3. Write your Dimensions
  4. Save to validate
  5. Review your changes (optional)
  6. Publish
  7. Verify in CloudZero

Step 1: Log in to CloudZero

  1. Open the command palette (⇧⌘P / Ctrl+Shift+P) and select CloudZero: Authenticate.
CloudZero Authenticate command in the command palette
  1. Your browser opens the CloudZero login page. Enter your credentials and you are redirected to a success page.
CloudZero login page
  1. Close the browser tab and return to VS Code. A notification confirms you are logged in.
VS Code notification confirming CloudZero login

After logging in, a CloudZero icon appears in the VS Code Activity Bar (the vertical icon bar on the left). Click it to open the CloudZero Sidebar, which shows your organization and namespaces.

CloudZero sidebar showing Organization and Namespaces

Step 2: Download your definitions

Download your definitions file so you are working from the latest version. If your organization has not created any Dimensions yet, the file will be empty.

Option A: Use the command palette

  1. Open the command palette (⇧⌘P / Ctrl+Shift+P) and select CloudZero: Download CostFormation.
Download CostFormation command in the command palette
  1. If your organization has multiple namespaces, select the namespace to download from.
  2. Choose a location and filename in the Save dialog.

Option B: Use the CloudZero Sidebar

  1. Right-click a namespace in the CloudZero Sidebar.
  2. Select Download CostFormation.
  3. Choose a location and filename in the Save dialog.
Right-click context menu on a namespace
ℹ️

Definition files use the .cz.yaml extension. If you do not specify an extension when saving, .cz.yaml is appended automatically.

Step 3: Write your Dimensions

The extension provides autocompletion as you write. Start typing any of these keywords to see what is available:

KeywordWhat it provides
exampleComplete starter Dimensions: Static Grouping, Dynamic Grouping, Even Allocation, Proportional Allocation
dimensionDimension definition structure
ruleRule templates for static groups, dynamic groups, and filtered dynamic groups
conditionCondition templates, with or without scoped sources
sourceSource templates, plus live source IDs from your CloudZero organization (tags, account attributes, Kubernetes labels, and more)
transformsTransform section and individual transform templates
(in a Streams section)Live stream names from your CloudZero organization

For copy-paste Dimension examples you can adapt, see CostFormation Templates. For the complete YAML syntax reference, see CostFormation Reference.

Step 4: Save to validate

The extension validates your definitions automatically:

WhenWhat it catches
As you typeSyntax errors: malformed YAML, invalid keywords, missing fields
When you saveSemantic errors: invalid source IDs, dependency cycles, structural problems

Errors from inline validation appear as red underlines in the editor. Errors from platform validation appear in the VS Code Problems panel. Fix all errors before publishing.

Step 5: Review your changes (optional)

  1. Open the command palette (⇧⌘P / Ctrl+Shift+P) and select CloudZero: Review CostFormation Changes Against CloudZero. A read-only side-by-side diff opens in a new tab.
Side-by-side diff view comparing local and published definitions
  1. Review your changes against the published version. If anything needs adjusting, return to your definitions file, make the changes, and save to re-validate.

Step 6: Publish

  1. Open the command palette (⇧⌘P / Ctrl+Shift+P) and select CloudZero: Publish CostFormation.
Publish CostFormation command in the command palette
  1. The extension validates your definitions. If validation passes, the definitions are published to the namespace associated with the file. If validation fails, the publish is blocked, errors appear in the Problems panel, and the affected lines are underlined in red.

Step 7: Verify in CloudZero

After publishing, CloudZero begins materializing your Dimensions. Changes are retroactive, applied across your full cost history, and appear in Explorer within a few minutes.

Restore a previous version of your definitions

If you publish definitions that need to be reverted, you can restore a previous version.

  1. Open the command palette (⇧⌘P / Ctrl+Shift+P) and select CloudZero: Restore Older CostFormation, or right-click a definition file in the sidebar and select Restore Older CostFormation.
List of previous definition versions
  1. Select the version to restore from the list (most recent first).
  2. Choose Restore to publish that version immediately, or Save Locally to download it for further editing before publishing.
Restore or save locally dialog
ℹ️

Restoring does not delete any versions. It republishes the older version you selected as the new latest version. Your full version history is preserved, so you can always go back again if needed.

For namespaces, conflict resolution, telemetry annotations, and troubleshooting, see Advanced Usage.

Command reference

CommandWhat it does
CloudZero: AuthenticateLog in to the CloudZero platform
CloudZero: Download CostFormationDownload definitions for a namespace
CloudZero: Publish CostFormationPublish definitions to CloudZero
CloudZero: Review CostFormation Changes Against CloudZeroOpen a side-by-side diff of local vs. published definitions
CloudZero: Restore Older CostFormationRestore a previous version of definitions
CloudZero: Switch OrganizationSwitch to a different CloudZero organization
CloudZero Namespaces: Browse AllBrowse all namespaces in a searchable list
CloudZero Namespaces: New NamespaceCreate a new namespace
CloudZero Namespaces: Refresh NamespacesRefresh the namespace list
CloudZero Namespaces: Remove NamespaceDelete a namespace
ℹ️

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