Building CloudWatch Dashboards with IaC

Eden Hare
14 min readJan 19, 2022

I am a Sr. DevOps Consultant in Amazon Web Services Professional Services division. This article is my own work using publicly available information and does not necessarily reflect the opinions of my employer.

Amazon CloudWatch (hereafter referred to as CloudWatch) collects log and metric data from EC2 instances and other AWS services. CloudWatch includes a dashboard feature for viewing metrics and alarms to create notifications and perform actions when breaching an alarm threshold or when the alarm condition resets. CloudWatch is the AWS-provided observability platform.

CloudWatch dashboards are great for viewing the state of the environment in the console. Repeatedly designing a dashboard can be problematic as the console interface uses a “drag and drop” approach to designing the dashboard. It is hard to duplicate them in this manner.

We can use Infrastructure as Code (IaC) to define our dashboards. This article looks at why using CloudWatch Dashboards is beneficial, how to build one in the console, and finally, how to build a dashboard using IaC.

Why Use CloudWatch?

Applications and Infrastructure require a monitoring platform to understand the performance of those infrastructure resources and applications. There are many different observability platforms, including those developed in-house for an organization’s unique requirements. Using observability platforms, we have a single place to can view, analyze and correlate data across systems to understand the state of our environments.

Because CloudWatch integrates with more than 70 AWS services, it is the easiest way to collect our observability data. We can collect systems and application logs from both cloud and on-premises EC2 instances using the CloudWatch agent.

As mentioned, we can identify thresholds indicating possible problems, and both alert the appropriate teams and take automated action to mitigate the situation.

CloudWatch accomplishes its capabilities by collecting log data, metrics, and events across our application and infrastructure resources. We can view and analyze the data directly, or we can visually present the data using CloudWatch dashboards.



Eden Hare

Eden is the co-author of seven books and author of more than 100 articles and book chapters in technical, management, and information security publications.