- Newest
- Most votes
- Most comments
Hi,
I followed Gabriel's advice and I was not able to produce a metric widget using AWS CLI.
Some suggestions seems to not work at all. For example, the property view can only be one of timeSeries, bar or pie, there is no "timeSeriesStacked". Also property "type" inside the metric does work either.
Best
Hi Kerr,
To display the anomaly detection band in a graph background for CloudWatch metrics using an AWS Lambda function and the Image API, you need to modify the JSON code you provided to include the band definition. Here's how you can do it:
- Add a new "band" element within the "metrics" section, specifying the anomaly detection band:
"metrics": [ ["AWS/CloudFront", "BytesDownloaded", "Region", "Global", "DistributionId", "***********", { "id": "m1", "visible": true }], [{ "id": "ad1", "label": "Expected", "expression": "ANOMALY_DETECTION_BAND(m1, 3)", "visible": true, "color": "#000000", "yAxis": "left" }], [{ "expression": "m1 + ad1", "label": "Band", "color": "#c4c4c4", "yAxis": "left", "type": "area", "id": "band1" }] ],
In the code above, a new metric "Band" is defined, which is the sum of your original metric "m1" (BytesDownloaded) and the anomaly detection band "ad1." The "type" is set to "area," which creates a filled area graph representing the band.
- Adjust the "view" parameter to "timeSeriesStacked," which is commonly used to display anomaly detection bands:
"view": "timeSeriesStacked",
- Update the "stacked" parameter to "true" to ensure the graph displays the anomaly detection band:
"stacked": true,
- Ensure that you have appropriate permissions for your Lambda function to access CloudWatch metrics and make the necessary modifications to the Lambda code to generate and display the graph as needed.
With these modifications, your CloudWatch graph generated using the Image API should include the anomaly detection band in the background, providing a visual representation of expected values and deviations.
Please give a thumbs up if my suggestion helps
Relevant content
- asked 10 days ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 months ago