Synchronising CloudWatch dashboards

By Tom - July 04, 2018

It won’t take long on your AWS journey before you bump into CloudWatch- the repository of all logs and metrics. You’ll probably start by scanning through logs, progress to plotting the odd metric and graduate to a tidy little dashboard. If you’re dedicated you might even end up with degree level rules and alarms.

CloudWatch dashboards are fairly impressive, given how cheap they are to run. They’re a bit rough around the edges, and I wouldn’t want to hand them over to anyone non-technical; but in the age of devops, they’re an invaluable tool to help me keep en eye on our key system performance metrics, and spot issues before they become problems.

As you start to split across multiple environments (we’ve thus far managed to keep it down to development, staging and production), you’ll probably want a dashboard for each. And at that point you’ll notice a missing feature- templating.

Sure- you can export the dashboard as JSON, and do a cheeky find and replace and copy it back… But what programmer doesn’t enjoy a bit of automation?

The above script will synchronise a dashboard template across multiple environments (e.g. dashboard-one-masterdashboard-one-stagingdashboard-one-production) by replacing the environment name across all your resources (e.g. awesome-lambda-master will become awesome-lambda-stagingal la the Serverless Framework).

I’ve omitted the command line, as it’s part of a bigger suite of tools for us, but, as anything shared here, feel free to take it and tailor it to your needs.

Get dashboard’ing!

Want to see more great IoT content?

Sign up to our (spam-free!) newsletter for industry news, updates, and advice on how to get the most out of your project:


We promise that we won't SPAM you.