Troubleshoot Amazon CloudWatch data source issues
This document provides solutions to common issues you may encounter when configuring or using the Amazon CloudWatch data source. For configuration instructions, refer to Configure CloudWatch.
Note
The data source health check validates both metrics and logs permissions. If your IAM policy only grants access to one of these (for example, metrics-only or logs-only), the health check displays a red status. However, the service you have permissions for is still usable—you can query metrics or logs based on whichever permissions are configured.
Authentication errors
These errors occur when AWS credentials are invalid, missing, or don’t have the required permissions.
“Access Denied” or “Not authorized to perform this operation”
Symptoms:
- Save & test fails with “Access Denied”
- Queries return authorization errors
- Namespaces, metrics, or dimensions don’t load
Possible causes and solutions:
“Unable to assume role”
Symptoms:
- Authentication fails when using Assume Role ARN
- Error message references STS or AssumeRole
Solutions:
- Verify the trust relationship on the IAM role allows the Grafana credentials to assume it.
- Check the trust policy includes the correct principal (the user or role running Grafana).
- If using an external ID, ensure it matches exactly in both the role’s trust policy and the Grafana data source configuration.
- Verify the base credentials have the
sts:AssumeRolepermission. - Check that the role ARN is correct and the role exists.
Example trust policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<your-account-id>:user/<grafana-user>"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "<your-external-id>"
}
}
}
]
}AWS SDK Default authentication not working
Symptoms:
- Data source test fails when using AWS SDK Default
- Works locally but fails in production
Solutions:
- Verify AWS credentials are configured in the environment where Grafana runs.
- Check for credentials in the default locations:
- Environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - Shared credentials file (
~/.aws/credentials) - EC2 instance metadata (if running on EC2)
- ECS task role (if running in ECS)
- EKS service account (if running in EKS)
- Environment variables (
- Ensure the Grafana process has permission to read the credentials file.
- For EKS with IRSA, set the pod’s security context to allow user 472 (grafana) to access the projected token. Refer to AWS authentication for details.
Credentials file not found
Symptoms:
- Error indicates credentials file cannot be read
- Authentication fails with “Credentials file” option
Solutions:
- Create the credentials file at
~/.aws/credentialsfor the user running thegrafana-serverservice. - Verify the file has correct permissions (
0644). - If the file exists but isn’t working, move it to
/usr/share/grafana/and set permissions to0644. - Ensure the profile name in the data source configuration matches a profile in the credentials file.
Connection errors
These errors occur when Grafana cannot reach AWS CloudWatch endpoints.
“Request timed out” or connection failures
Symptoms:
- Data source test times out
- Queries fail with timeout errors
- Intermittent connection issues
Solutions:
- Verify network connectivity from the Grafana server to AWS endpoints.
- Check firewall rules allow outbound HTTPS (port 443) to AWS services.
- If using a VPC, ensure proper NAT gateway or VPC endpoint configuration.
- For Grafana Cloud connecting to private resources, configure Private data source connect.
- Check if the default region is correct—incorrect regions may cause longer timeouts.
- Increase the timeout settings if queries involve large data volumes.
Custom endpoint configuration issues
Symptoms:
- Connection fails when using a custom endpoint
- Endpoint URL rejected
Solutions:
- Verify the endpoint URL format is correct.
- Ensure the endpoint is accessible from the Grafana server.
- Check that the endpoint supports the required AWS APIs.
- For VPC endpoints, verify the endpoint policy allows the required actions.
CloudWatch Metrics query errors
These errors occur when querying CloudWatch Metrics.
“No data” or empty results
Symptoms:
- Query executes without error but returns no data
- Charts show “No data” message
Possible causes and solutions:
“Metric not found” or metrics don’t appear in drop-down
Symptoms:
- Expected metrics don’t appear in the query editor
- Metric drop-down is empty for a namespace
Solutions:
- Verify the metric exists in the selected region.
- For custom metrics, add the namespace to Namespaces of Custom Metrics in the data source configuration.
- Check that the IAM policy includes
cloudwatch:ListMetricspermission. - CloudWatch limits
ListMetricsto 500 results per page. To retrieve more metrics, increase thelist_metrics_page_limitsetting in the Grafana configuration file. - Use the Query Inspector to verify the API request and response.
Dimension values not loading
Symptoms:
- Dimension value drop-down doesn’t populate
- Wildcard searches return no results
Solutions:
- Verify the IAM policy includes
cloudwatch:ListMetricspermission. - Check that the namespace and metric are selected before dimension values can load.
- For EC2 dimensions, ensure
ec2:DescribeTagsandec2:DescribeInstancespermissions are granted. - Dimension values require existing metrics—if no metrics match, no values appear.
“Too many data points” or API throttling
Symptoms:
- Queries fail with throttling errors
- Performance degrades with multiple panels
Solutions:
- Increase the period setting to reduce the number of data points.
- Reduce the time range of your queries.
- Use fewer dimensions or wildcard queries per panel.
- Request a quota increase for
GetMetricDatarequests per second in the AWS Service Quotas console. - Enable query caching in Grafana to reduce API calls.
Metric math expression errors
Symptoms:
- Expression returns errors
- Referenced metrics not found
Solutions:
- Verify each referenced metric has a unique ID set.
- Check that metric IDs start with a lowercase letter and contain only letters, numbers, and underscores.
- Ensure all referenced metrics are in the same query.
- Verify the expression syntax follows AWS Metric Math documentation.
- Metric math expressions can’t be used with Grafana alerting if they reference other query rows.
CloudWatch Logs query errors
These errors occur when querying CloudWatch Logs.
“Query failed” or logs don’t appear
Symptoms:
- Log queries return errors
- No log data is displayed
Solutions:
- Verify log group names are correct and exist in the selected region.
- Check the IAM policy includes
logs:StartQuery,logs:GetQueryResults, andlogs:DescribeLogGroupspermissions. - Ensure the time range contains log data.
- Verify the query syntax is valid. For CloudWatch Logs Insights QL, test the query in the AWS Console.
- Select the correct query language (Logs Insights QL, OpenSearch PPL, or OpenSearch SQL) based on your query syntax.
Log query timeout
Symptoms:
- Query runs for a long time then fails
- Error mentions timeout
Solutions:
- Increase the Query timeout result setting in the data source configuration (default is 30 minutes).
- Narrow the time range to reduce the amount of data scanned.
- Add filters to your query to limit results.
- Break complex queries into smaller, more focused queries.
- For alerting, the timeout defined in the Grafana configuration file takes precedence.
Log groups not appearing in selector
Symptoms:
- Log group selector is empty
- Can’t find expected log groups
Solutions:
- Verify the IAM policy includes
logs:DescribeLogGroupspermission. - Check that log groups exist in the selected region.
- For cross-account observability, ensure proper IAM permissions for
oam:ListSinksandoam:ListAttachedLinks. - Use prefix search to filter log groups if you have many groups.
- Verify the selected account (for cross-account) contains the expected log groups.
OpenSearch SQL query errors
Symptoms:
- OpenSearch SQL queries fail
- Syntax errors with SQL queries
Solutions:
Specify the log group identifier or ARN in the
FROMclause:SELECT * FROM `log_group_name` WHERE `@message` LIKE '%error%'For multiple log groups, use the
logGroupsfunction:SELECT * FROM `logGroups(logGroupIdentifier: ['LogGroup1', 'LogGroup2'])`Amazon CloudWatch supports only a subset of OpenSearch SQL commands. Refer to the CloudWatch Logs documentation for supported syntax.
Template variable errors
These errors occur when using template variables with the CloudWatch data source.
Variables return no values
Symptoms:
- Variable drop-down is empty
- Dashboard fails to load with variable errors
Solutions:
- Verify the data source connection is working.
- Check that the IAM policy includes permissions for the variable query type:
- Regions: No additional permissions needed.
- Namespaces: No additional permissions needed.
- Metrics: Requires
cloudwatch:ListMetrics. - Dimension Values: Requires
cloudwatch:ListMetrics. - EC2 Instance Attributes: Requires
ec2:DescribeInstances. - EBS Volume IDs: Requires
ec2:DescribeVolumes. - Resource ARNs: Requires
tag:GetResources. - Log Groups: Requires
logs:DescribeLogGroups.
- For dependent variables, ensure parent variables have valid selections.
- Verify the region is set correctly (use “default” for the data source’s default region).
For more information on template variables, refer to CloudWatch template variables.
Multi-value template variables cause query failures
Symptoms:
- Queries fail when selecting multiple dimension values
- Error about search expression limits
Solutions:
- Search expressions are limited to 1,024 characters. Reduce the number of selected values.
- Use the asterisk (
*) wildcard instead of selecting “All” to query all metrics for a dimension. - Multi-valued template variables are only supported for dimension values—not for Region, Namespace, or Metric Name.
Cross-account observability errors
These errors occur when using CloudWatch cross-account observability features.
Cross-account queries fail
Symptoms:
- Can’t query metrics or logs from linked accounts
- Monitoring account badge doesn’t appear
Solutions:
Verify cross-account observability is configured in the AWS CloudWatch console.
Add the required IAM permissions:
{ "Version": "2012-10-17", "Statement": [ { "Action": ["oam:ListSinks", "oam:ListAttachedLinks"], "Effect": "Allow", "Resource": "*" } ] }Check that the monitoring account and source accounts are properly linked in AWS.
Cross-account observability works within a single region—verify all accounts are in the same region.
EC2 Instance Attributes can’t be queried across accounts because they use the EC2 API, not the CloudWatch API.
Quota and pricing issues
These issues relate to AWS service quotas and cost management.
API throttling errors
Symptoms:
- “Rate exceeded” errors
- Dashboard panels intermittently fail to load
Solutions:
- Reduce the frequency of dashboard refreshes.
- Increase the period setting to reduce
GetMetricDatarequests. - Enable query caching in Grafana (available in Grafana Enterprise and Grafana Cloud).
- Request a quota increase in the AWS Service Quotas console.
- Consider consolidating similar queries using metric math.
Unexpectedly high CloudWatch costs
Symptoms:
- AWS CloudWatch costs are higher than expected
- Frequent API calls from Grafana
Solutions:
- The
GetMetricDataAPI doesn’t qualify for the CloudWatch API free tier. - Reduce dashboard auto-refresh frequency.
- Increase the period setting to reduce data points returned.
- Use query caching to reduce repeated API calls.
- Review variable query settings—set variable refresh to “On dashboard load” instead of “On time range change.”
- Avoid using wildcards in dimensions when possible, as they generate search expressions with multiple API calls.
Other common issues
These issues don’t produce specific error messages but are commonly encountered.
Custom metrics don’t appear
Symptoms:
- Custom metrics from applications or agents don’t show in the namespace drop-down
- Only standard AWS namespaces are visible
Solutions:
- Add your custom metric namespace to the Namespaces of Custom Metrics field in the data source configuration.
- Separate multiple namespaces with commas (for example,
CWAgent,CustomNamespace). - Verify custom metrics have been published to CloudWatch in the selected region.
Pre-configured dashboards not working
Symptoms:
- Imported dashboards show no data
- Dashboard variables don’t load
Solutions:
- Verify the data source name in the dashboard matches your CloudWatch data source.
- Check that the dashboard’s AWS region setting matches where your resources are located.
- Ensure the IAM policy grants access to the required services (EC2, Lambda, RDS, etc.).
- Verify resources exist and are emitting metrics in the selected region.
X-Ray trace links not appearing
Symptoms:
- Log entries don’t show X-Ray trace links
@xrayTraceIdfield not appearing
Solutions:
- Verify an X-Ray data source is configured and linked in the CloudWatch data source settings.
- Ensure your logs contain the
@xrayTraceIdfield. - Update log queries to include
@xrayTraceIdin the fields, for example:fields @message, @xrayTraceId. - Configure your application to log X-Ray trace IDs. Refer to the AWS X-Ray documentation.
Enable debug logging
To capture detailed error information for troubleshooting:
Set the Grafana log level to
debugin the configuration file:[log] level = debugReview logs in
/var/log/grafana/grafana.log(or your configured log location).Look for CloudWatch-specific entries that include request and response details.
Reset the log level to
infoafter troubleshooting to avoid excessive log volume.
Get additional help
If you’ve tried the solutions above and still encounter issues:
- Check the Grafana community forums for similar issues.
- Review the CloudWatch plugin GitHub issues for known bugs.
- Consult the AWS CloudWatch documentation for service-specific guidance.
- Contact Grafana Support if you’re an Enterprise, Cloud Pro, or Cloud Contracted user.
- When reporting issues, include:
- Grafana version
- AWS region
- Error messages (redact sensitive information)
- Steps to reproduce
- Query configuration (redact credentials and account IDs)



