AWS AmazonCloudWatch documentation change
Summary
Added examples and documentation for using tags in Metrics Insights queries for alarm creation, including CLI command update with tag filtering
Security assessment
The changes demonstrate using tags for resource monitoring but do not address security vulnerabilities or introduce security features. The note about tag matching during evaluation periods is operational guidance.
Diff
diff --git a/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-alarm-create.md b/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-alarm-create.md index bc7e53195..22abf2cfc 100644 --- a//AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-alarm-create.md +++ b//AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-alarm-create.md @@ -20,0 +21,18 @@ In the **Editor** view, you can start writing your query. As you type, the edito +For example, when creating your Metrics Insights query for the alarm, you can use tags to filter and group metrics for more targeted monitoring. + + * Filter by tags – Use `WHERE tag.keyName = 'value'` to monitor resources with specific tags + + SELECT MAX(CPUUtilization) FROM "AWS/EC2" WHERE tag.Environment = 'Prod' + + * Combine tags with dimensions – Mix tag filters with existing metric dimensions + + SELECT AVG(Duration) FROM "AWS/Lambda" WHERE tag.Application = 'OrderService' AND FunctionName = 'process%' + +###### Note + +When using tags, alarms will match the metrics only if the specified tags existed on the associated resources during the evaluated time period. + +###### Important + +To set an alarm on a Metrics Insights query, the query must return a single time series. If it contains a GROUP BY statement, the GROUP BY statement must be wrapped inside a metric math expression that returns only one time series as the final result of the expression. + @@ -58,5 +76 @@ To create an alarm that performs an SSM Incident Manager action, you must have c -###### To create an alarm on a Metrics Insights query using the AWS CLI - - * Use the `put-metric-alarm` command and specify a Metrics Insights query in the `metrics` parameter. For example, the following command sets an alarm that goes into ALARM state if any of your instances go above 50% in CPU utilization. - - aws cloudwatch put-metric-alarm --alarm-name Metrics-Insights-alarm --evaluation-periods 1 --comparison-operator GreaterThanThreshold --metrics '[{"Id":"m1","Expression":"SELECT MAX(CPUUtilization) FROM SCHEMA(\"AWS/EC2\", InstanceId)", "Period":60}]' --threshold 50 +**To create an alarm on a Metrics Insights query using the AWS CLI** @@ -63,0 +78 @@ To create an alarm that performs an SSM Incident Manager action, you must have c +Use the `put-metric-alarm` command and specify a Metrics Insights query in the `metrics` parameter. For example, the following command sets an alarm that goes into ALARM state if any of your instances go above 50% in CPU utilization. @@ -65,0 +81 @@ To create an alarm that performs an SSM Incident Manager action, you must have c + aws cloudwatch put-metric-alarm —alarm-name Prod-App-CPU-Alarm —evaluation-periods 1 —comparison-operator GreaterThanThreshold —metrics '[{"Id":"m1","Expression":"SELECT MAX(CPUUtilization) FROM \"AWS/EC2\" WHERE tag.Environment = '\''Prod'\'' AND tag.Application = '\''OrderService'\''", "Period":60}]' —threshold 80