How can I dynamically update my AWS CloudWatch dashboards?

自古美人都是妖i 提交于 2019-12-23 01:37:37

问题


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.


回答1:


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)




回答2:


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



来源:https://stackoverflow.com/questions/42930622/how-can-i-dynamically-update-my-aws-cloudwatch-dashboards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!