AWS CloudWatch Dashboard

This page shows how to write Terraform and CloudFormation for CloudWatch Dashboard and write them securely.

aws_cloudwatch_dashboard (Terraform)

The Dashboard in CloudWatch can be configured in Terraform with the resource name aws_cloudwatch_dashboard. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

dashboards.tf#L1
resource "aws_cloudwatch_dashboard" "iaps" {
  count = var.deploy_iaps_v1 == false ? 0 : 1
  dashboard_name = "iaps"
  dashboard_body = data.template_file.iaps_dashboard.rendered
}

terraform.tf#L22
resource "aws_cloudwatch_dashboard" "dash" {
  dashboard_name = "Brutalismbot"
  dashboard_body = file("dashboard.json")
}
main.tf#L1
resource "aws_cloudwatch_dashboard" "ec2" {
  dashboard_name = "ec2-general"
  dashboard_body = jsonencode({
    "widgets" : [
      {
        "type" : "explorer",
main.tf#L7
resource "aws_cloudwatch_dashboard" "this" {
  dashboard_body = var.dashboard_body
  dashboard_name = var.dashboard_name
}

cloudwatch.tf#L2
resource "aws_cloudwatch_dashboard" "www-bds-code" {
  dashboard_name = "www-bds-code"

  dashboard_body = <<EOF
{
    "widgets": [

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a CloudWatch Dashboard resource.

AWS::CloudWatch::Dashboard (CloudFormation)

The Dashboard in CloudWatch can be configured in CloudFormation with the resource name AWS::CloudWatch::Dashboard. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

The AWS::CloudWatch::Dashboard resource specifies an Amazon CloudWatch dashboard. A dashboard is a customizable home page in the CloudWatch console that you can use to monitor your AWS resources in a single view.

All dashboards in your account are global, not region-specific.

Frequently asked questions

What is AWS CloudWatch Dashboard?

AWS CloudWatch Dashboard is a resource for CloudWatch of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS CloudWatch Dashboard?

For Terraform, the ministryofjustice/hmpps-delius-iaps-shared-terraform, brutalismbot/monitoring and BradleyChatha/infrastructure source code examples are useful. See the Terraform Example section for further details.