Rome_Leader
Rome_Leader

Reputation: 2700

How can I dynamically update my AWS CloudWatch dashboards?

I have several dashboards in CloudWatch that represent a static view of my infrastructure, for instance, how many instances from an autoscaling worker group are currently running, or the CPU/disk status of various key EC2 instances. However, when I add new instances, I am always stuck manually updating the dashboards to include them in the display.

I'm curious if there is there any way to programmatically populate these dashboards, say through a CLI/API call using an AWS Lambda function? It would be ideal if dashboards could update based on triggers similarly to how Lambda functions know when to execute based on a variety of events/a schedule.

Upvotes: 3

Views: 4251

Answers (2)

Javier Diaz
Javier Diaz

Reputation: 1830

Better late than never, it seems that CloudWatch has implemented a SEARCH function with metric expressions.

There are good examples in the documentation:

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

Upvotes: 5

anon
anon

Reputation:

You can update your dashboards through the cloudWatch Dashboards API and through CloudFormation templates

This was released in July 2017 (see blog post) and corresponding PutDashboard API reference and CloudFormation documentation.

An example on how to update the dashboards dynamically is explained here

Upvotes: 0

Related Questions