Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use the AWS api to create Cloudwatch graphs?

Is it possible to create graphs programmatically in a Cloudwatch dashboard using the AWS API or a SDK?

Edit I'd like to use the API to create Metric and Text widgets in the Cloudwatch Dashboard. I do not want to manually create each graph.

like image 351
todgru Avatar asked Jul 20 '16 18:07

todgru


People also ask

Which API call allows you to push custom metric data to CloudWatch?

If your use case doesn't support the use of the CloudWatch unified agent, you can use the PutMetricData API to push custom metrics to CloudWatch.

How do you visualize CloudWatch logs?

To see the visualization, run your query. Then choose the Visualization tab, select the arrow next to Line, and choose Bar. Visualizations are limited to up to 100 bars in the bar chart. For a complete tutorial, see Tutorial: Run a query that produces a visualization grouped by log fields.


2 Answers

As of 05 Jul 2017 it is possible: https://aws.amazon.com/blogs/aws/new-api-cloudformation-support-for-amazon-cloudwatch-dashboards/

like image 175
Paulo Schreiner Avatar answered Oct 12 '22 23:10

Paulo Schreiner


This answer is now out of date, please see the other answer about using CloudFormation to codify CloudWatch Dashboards. For historical purposes here is my original reply: The accepted answer is effectively "no". However it may be worth noting that if you were to create a graph through the web interface and inspect the URL that is generated for you through the "Copy URL" button, you can see the patterns it uses and you could come up with your own URL. Note that when you click the "Copy URL" button in the CloudWatch web interface, it doesn't do anything special on its backend other than programmatically generate a URL for you based on your currently selected options. Therefore in a way this offers you a way to generate your own graphs programmatically, albeit in a rather unintuitive and messy way since as far as I can tell there isn't a published specification for how those URLs are assembled and you must figure it out on your own through trial and error.

like image 22
Ethan H Avatar answered Oct 12 '22 23:10

Ethan H