This is documentation for the next version of Grafana documentation. For the latest stable release, go to the latest version.
Amazon CloudWatch alerting
You can use Grafana Cloud to avoid installing, maintaining, and scaling your own instance of Grafana. Create a free account to get started, which includes free forever access to 10k metrics, 50GB logs, 50GB traces, 500VUh k6 testing & more.
The Amazon CloudWatch data source supports Grafana Alerting. You can create alert rules on CloudWatch metrics and CloudWatch Logs, so Grafana notifies you when a metric crosses a threshold or when a log query returns a value that meets your alert condition.
This is Grafana Alerting evaluated by Grafana, not CloudWatch alarms. To visualize the history of existing CloudWatch alarms instead, refer to Amazon CloudWatch annotations.
Before you begin
Before you create alert rules with CloudWatch data, ensure you have:
- A configured Amazon CloudWatch data source.
- Permissions to create alert rules in Grafana.
- Familiarity with Grafana Alerting concepts.
Supported query types for alerting
Alert rules require queries that return numeric data that Grafana can evaluate against a threshold. CloudWatch supports alerting for the following query types:
Note
You can’t create an alert rule from a metric math expression that references another query, such as
queryA * 2. Define the metric directly in the alert query instead.
Create an alert rule
To create an alert rule using CloudWatch data:
- Go to Alerting > Alert rules.
- Click New alert rule.
- Enter a name for your alert rule.
- In the Define query and alert condition section:
- Select your Amazon CloudWatch data source.
- Configure your query, for example, a Metrics query for
CPUUtilizationor a Logs query that uses thestatscommand. - Add a Reduce expression if your query returns multiple series.
- Add a Threshold expression to define the alert condition.
- Configure the Set evaluation behavior section:
- Select or create a folder and evaluation group.
- Set the evaluation interval.
- Set the pending period.
- Add labels and annotations to provide context for notifications.
- Click Save rule.
For detailed instructions, refer to Create a Grafana-managed alert rule.
Example: metric threshold alert
This example fires when average EC2 CPU utilization exceeds 80%:
- Create a new alert rule.
- Configure the query:
- Namespace:
AWS/EC2 - Metric name:
CPUUtilization - Statistic:
Average - Dimensions:
InstanceId
- Namespace:
- Add expressions:
- Reduce: Last, to get the most recent data point.
- Threshold: Is above 80.
- Set evaluation to run every 1 minute with a 5-minute pending period.
- Save the rule.
Example: log error count alert
This example alerts when the number of log entries that contain Exception exceeds a threshold. CloudWatch Logs alerting requires a query that returns numeric data, which you can produce with the stats command:
Create a new alert rule.
Configure the query:
Select CloudWatch Logs as the query mode.
Select the region and log groups to query.
Enter the following query:
filter @message like /Exception/ | stats count(*) as exceptionCount by bin(5m)
Add expressions:
- Reduce: Max, to get the highest count in the period.
- Threshold: Is above 10.
Set evaluation to run every 5 minutes.
Save the rule.
Note
If you receive an error such as
input data must be a wide series but got ..., make sure your query returns numeric data that can render in a time series panel.
CloudWatch Logs timeouts during alert evaluation
For CloudWatch Logs queries, Grafana polls AWS until the query completes or a timeout is reached. During alert evaluation, the timeout defined in the Grafana configuration file takes precedence over the Query Result Timeout setting on the data source. Set the configuration timeout high enough for your log queries to finish.
Best practices
Follow these recommendations to create reliable alerts with CloudWatch data.
Test queries before alerting
Verify your query returns numeric data before you create an alert:
- Go to Explore.
- Select your Amazon CloudWatch data source.
- Run the query you plan to use for alerting.
- Confirm the result is numeric and suitable for threshold evaluation.
Reduce multiple series
When a query returns multiple time series, use the Reduce expression to aggregate them into a single value with Last, Mean, Max, Min, or Sum.
Handle no data conditions
Configure how the rule behaves when no data is returned under Configure no data and error handling. Choose No Data, Alerting, or OK based on whether missing data should be treated as a problem.
Troubleshoot alerting
If your CloudWatch alerts don’t work as expected, use the following sections to diagnose common issues.
Alerts don’t fire
- Confirm the query returns numeric data in Explore.
- Ensure the evaluation interval allows enough time for data to be available.
- Review the alert rule’s health and any error messages in the Alerting UI.
Log query alerts time out
- Increase the Grafana configuration file timeout, which takes precedence during alert evaluation.
- Narrow the time range or add filters to reduce the volume of data the query scans.
For more help, refer to Troubleshoot Amazon CloudWatch.


