Dashboard automation

Now we will discuss automated deployment of Amazon CloudWatch dashboards and alarms. You can have dashboards and alarms set up whenever you create an Amazon DocumentDB cluster, or you can add them afterwards when you move a database into production.

You will use CloudFormation in this chapter, but you can also use Terraform, the CDK, or the AWS SDKs as part of a CI/CD pipeline.

You will deploy a CloudFormation stack that creates a simple dashboard for our Amazon DocumentDB cluster.

To get started, you need to deploy Dashboard template. Go to the CloudFormation console and make sure you’re in the right region. Select Create stack -> With new resources.

Create stack

Next copy following template url to your clipboard


and paste it to Amazon S3 URL textbox as shown below: Upload template

Give the stack a name and specify the cluster identifier for your database. The cluster identifier is available on the console, as described in the Query Cluster section.

Stack details

On the next page accept all default values and click Next. Then on the final review page click Create stack.

When the stack is done deploying, go to the Dashboards section in Amazon CloudWatch and open the dashboard called DocumentDB-Metrics.


As you can see, this dashboard shows CPU utilization, IOPS, I/O latency, and swap usage for the primary and read replicas. It also shows replication lag and a summary of alarm status.


The sample dashboard includes only a subset of the metrics we discussed earlier. You should use this sample dashboard as a starting point to create your own dashboards.

Note that the alarm does not trigger any actions yet; you should decide what you’d like to do in the event of an alarm going off. Depending on the situation, you may want to send an email to the operations team or open a ticket in your ticketing system.