This section assumes you already have VSCode installed and running on your system. If that is not true, go to the VSCode website (https://code.visualstudio.com) to install the latest version, you will need version 1.57.1 or higher.
Installing and Updating the Toolkit Extension
Once you have VSCode installed and running on your system you will need to install the CloudZero CostFormation Toolkit extension. To do this, click on the Extensions Marketplace icon in VSCode and search for CloudZero. When you see the CostFormation Toolkit, click on Install.
Connecting to the CloudZero Platform
For many of the features to work, you must be authenticated with the CloudZero platform and have the organizer role for your organization. To login, enter the VSCode command palette (⇧⌘P/Ctrl-Shift-P) and select the command CloudZero: Authenticate With the CloudZero Platform
Your default browser will open to the CloudZero login page where you can enter your credentials just the same as if you were using CloudZero's services.
After your credentials have been authenticated, you will be redirected to a page indicating you have successfully logged in. At this point you can close that page and return to VSCode.
Creating a New Definitions File
If you do not already have any custom dimensions you can begin to define new custom definitions by opening a new file and save it. When prompted for the filename, you can name the file however you like, but the extension of the file must be .cz.yaml.
Downloading the Latest Definitions
If your organization already has custom definitions defined, you can download them and save them locally. To do this, enter the VSCode command palette (⇧⌘P/Ctrl-Shift-P) and select the command CloudZero: Download Latest CostFormation.
The VSCode Save dialog will appear. Enter a name for your file and click Save.
The file extension must be .cz.yaml, but if you do not specify an extension, .cz.yaml will be automatically added.
Creating your First Custom Dimensions
If you have not defined any extension and want to see an example that can be modified to your needs, there are two built-in examples:
Static Grouping: This example shows how to create rules that use statically named elements
Dynamic Grouping: This example shows how to create a rule that will generate dynamically named elements using the source data.
These examples are part of the autocomplete feature. To add one of the examples to your definitions file, simply start typing the word example and you will see the two examples.
Select one of the examples and it will be entered into you file. Your curser will be placed in the first area that can be customized (the dimension ID). At this point you can enter own ID. When you hit the Tab key, it will take you to other fields that you can customize.
- Although the two methods of grouping elements are shown as separate examples, these types of rules can be combined to create a dimension with both statically and dynamically named elements.
- These example templates are intended to be used in an empty file and as such they contain the root element - Dimensions: - of a definitions file. This means that if you add both examples, you will need to delete one of those lines.
Updated about 2 months ago