- Newest
- Most votes
- Most comments
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:
-
Store your JSON data in S3 with clear timestamp information for each data point.
-
Create a Lambda function that retrieves the relevant data from S3 based on the current dashboard time range.
-
Use a custom widget that calls this Lambda function and displays the returned data.
-
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
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 4 years ago
but pushing the data to cloudwatch would still not retain the metrics after 2 or 3 years right ?