跳至內容

Is it possible to build and dynamically refresh a cloudwatch dashboard based on data in the form of json

0

Context:

The goal is to store variety of metrics that can be retained in long run for historical analysis ( more than a year or two ) and the current plan is to dump the required metrics into s3 bucket in the form of json and retrieve them to build a dashboard through text widgets and display the required data. The dashboard is getting built and the data is shown in expected manner, how ever the dynamic refresh such as displaying data as per the timeline selected is not functional. Need to know if there's any timestamp format that needs to be configured in the json values for the widgets to get modified accordingly or its not possible to dynamically update the widgets for json source.

已提問 1 年前檢視次數 451 次

1 個回答
0

Yes, it is possible to build and dynamically refresh a CloudWatch dashboard based on data in JSON format, but there are some important considerations and limitations to keep in mind.

Custom widgets in CloudWatch dashboards can be used to display data from external sources, including JSON data stored in S3 buckets. These widgets work by calling an AWS Lambda function that can retrieve and process the data before returning it to the dashboard for display.

However, the dynamic refresh functionality you're looking for, where the data updates based on the selected time range, is not natively supported for custom widgets displaying data from external JSON sources. CloudWatch dashboards are designed to work seamlessly with CloudWatch metrics, which have built-in time series capabilities.

To achieve something close to what you're aiming for, you could consider the following approach:

  1. Store your JSON data in S3 with clear timestamp information for each data point.

  2. Create a Lambda function that retrieves the relevant data from S3 based on the current dashboard time range.

  3. Use a custom widget that calls this Lambda function and displays the returned data.

  4. Implement a refresh mechanism in your custom widget code to periodically call the Lambda function and update the displayed data.

Keep in mind that this approach won't provide the same level of interactivity and performance as native CloudWatch metrics. The refresh rate will be limited, and you'll need to handle time range selection manually in your Lambda function.

For long-term historical analysis, you might want to consider using a purpose-built time series database or data warehouse solution that can handle large volumes of time-stamped data more efficiently than JSON files in S3.

If real-time updates and interactive time range selection are crucial for your use case, you may want to explore pushing your metrics directly to CloudWatch instead of storing them as JSON in S3. This would allow you to leverage CloudWatch's native capabilities for time series data and dynamic dashboard updates.

Sources
Using a custom widget on a CloudWatch dashboard - Amazon CloudWatch
Details about custom widgets in CloudWatch - Amazon CloudWatch

已回答 1 年前

專家

已審閱 1 年前

  • but pushing the data to cloudwatch would still not retain the metrics after 2 or 3 years right ?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。