Create dynamic cross account CloudWatch Dashboard


Currently any time I add an EC2 instance, I need to manually add the metric to the existing widget(s) in my CloudWatch Dashboard. I know there are Automatic Dashboards that are "Resource Aware" so that any time a new instance is added/removed their respective widgets are updated accordingly automatically. How do I mirror that capability in my widgets for cross account dashboards?

asked 2 years ago731 views
1 Answer

Hi Joe,

Thanks for your question. Keeping your Dashboard dynamically up to date is no easy job but with Metrics Explorer [1] and Search Expression [2] it can be tackled quite simply.

Metrics Explorer is a feature that allows you to dynamically populate metrics by the resource tags. For instance in your case, we can filter by the Instance Name tag or any other tag that you find common around the EC2 instances that you dynamically want to monitor on your Dashboard. Metrics Explorer Console view example

Once you create the graphs on your Explorer, you can add it as a Metrics Explorer widget to the Dashboard.

Alternatively, Search Expression can be also used here and it supports searching by the Namespace, Metric Name, Dimension Name and Dimension Values. For instance you can use below search expression to find all the CPUUtilization metrics from AWS/EC2 namespace with InstanceId schema(which is the dimension list for that metric).

SEARCH('{AWS/EC2,InstanceId} MetricName="CPUUtilization"', 'Average', 300)

Search Expression example

Please check the related documents for detail information and including the limitations as well.

Hope this helps!


answered 2 years ago
  • Hi @Munkhbat_T, I appreciate your answer! I've used Metric Explorer in the past without issue, my blocker here is that it's only of use in a singular account. I was wondering if there's a way to do the same type of build out for cross account dashboards.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions