AWS CloudWatch Dashboard Builder - How To Use Guide
Tags: aws, opensource, monitoring, productivity
Published: 2023-01-04 09:03:46

This is the last post in the CloudWatch Dashboard Builder series. In this post I walk you through on how to use the tool. I recommend you read the post on [namespace template](https://dev.to/aws-builders/aws-cloudwatch-dashboard-builder-how-to-use-guide-30ej) if you haven't already. It will help you better comprehend the tool. You will also be able to create your own namespace template for use with the tool. 

## Download
The executable for the AWS CloudWatch Dashboard Builder can be found [here](https://github.com/hseera/cloudwatch-dashboard-builder/blob/main/cloudwatch_dashboard_builder.zip).

_If you like the tool, please **rate** it on github. Also, if you **spot a bug**, please file an issue so that I can fix it. Make sure to download the latest version of executable as it may have new updates._

## Workbench Configuration
When you run the **CloudWatch Dashboard Builder** executable, you will be presented with the Config screen.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktvx1zno9on8eraopy1n.png)

In the tool, you have two options for connecting to AWS services using credentials. The first step is to manually enter credentials on the configuration tab. Another option is to keep your credentials in the following location on your Windows PC.

`/Users/[username]/.aws`

_Example:_
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/69jrs5337x8ym9mzrp2q.png)
 
 
For the article, we'll enter our credentials into the text box and connect. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/76ugnt5wcwpchzhlcaob.png)

Once the connection is established, select the "Cloudwatch Dashboard Builder" tab. Here and the "Namespace Query Template" tab is where the magic happens. The following are the various components that comprise the screen. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkdcwglye3xujs1p4t33.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g161f7ww2fnayl6p6lr7.png)

# 1. Namespace
A namespace is a container for CloudWatch metrics. Metrics in different namespaces are isolated from each other. Namespace list is automatically populated when "Cloudwatch Dashboard Builder" tab is clicked. List can also be refreshed by right clicking on the list and selecting "Refresh Namespace".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efqssijjhafkfh2fgn51.png)

# 2. Template
A template is a namespace-contained container for CloudWatch metrics. Each namespace template reports on distinct metrics. Click on the namespace in the namespace list to see a list of all the templates in that namespace. For example, when you select an SQS namespace, it displays two different metric templates for it.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/twp8yz6ihqxkld348h7q.png)

# 3. Template detail
The template detail describes what the purpose of the template is. What is it meant to report? It also shows the template query that is associated with it. For example, selecting the "Top 10 queues by age" template gives you detail about the template and the SQL query associated with it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jep24l06l5ui08i8fqct.png)


# 4. Region Name
The region name displays a list of all AWS regions that are available around the world. To view the list, click the **"List Regions"** button.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pjfmbswocrxlqyt7gp81.png)

# 5. Existing Dashboards
If the AWS account already has existing CloudWatch dashboards, you can view them my right clicking on the "Existing Dashboard" list and selecting "Show Existing Dashboards"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rjpmfsmguj15w8lslr6k.png)

# 6. Dashboard Queries
To add queries to the dashboard, highlight the query, right-click on it, and select the "Add Query" option. This will add the query to the query list.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1kcb5xz5000jgzgv3n4f.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lmj9syiou1ham2kke93n.png)

You can remove the query from the list by selecting it, right-clicking, and clicking on the "Remove Query" option.

# 7. CloudWatch Dashboard JSON
To generate the CloudWatch dashboard JSON, right click on the query list and click on "Generate Dashboard JSON."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o3otbrm5hyguq5syrcru.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1d5vhr6ekm2e5xa9dl0b.png)

At this point, you have two options. You can either copy the JSON and use it via the CLI or AWS Console to generate the dashboard, or you can directly create it through the tool.

# 8. Create Dashboard
To create a dashboard through the tool, enter the dashboard name in the "Dashboard Name" text field and click on the "Create Dashboard" button. You will see a message in the console indicating whether the dashboard was successfully created or not.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6szvzr6x9e56fkcytv2g.png)

# 9. Console
The console screen contains all errors, responses, and logs. The tool's **"Save Output"** option allows you to save console data for further analysis. To clear the console message, use **"Clear Output"**. In the current version, the output is saved in the same folder as the executable. "output.txt" is the name of the output file.

# 10. Namespace Query Template
The Namespace Query Template tab allows you to load and edit the namespace query template. You can add new templates to existing namespaces, create new namespaces and templates, and delete or modify existing namespaces and templates.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kacg635h49ul6i6zux6e.png)

## Tool Caveats
There are a couple of caveats that need to be taken into account.

- Currently there is only Windows executable shared on github. Since the code is open source, you could build one to run on Linux.

- 
The present version produces only a time series dashboard.

- Double quotes in the namespace template queries need to be escaped.

Finally, here is a video showing how to use the tool to generate a dashboard or how to use the JSON to construct a dashboard using the CLI or AWS Console. 

{% embed https://youtu.be/tPCHCc-GiHM %}