For AWS CloudWatch, the key consideration is the 4 different authentication methods:
AWS SDK Default
IAM Role
AK&SK
Credentials file
The recommended approach is to use IAM Role authentication, which avoids the risk of credential leakage.
However, it’s important to note that to read CloudWatch metrics and EC2 tags, instances, regions, and alarms, you must grant Grafana the necessary permissions via IAM. You can attach these permissions to the IAM role or IAM user configured in your AWS authentication.
Alerts require queries that return numeric data, and CloudWatch Logs supports this type of query. For example, you can enable alerting by using the stats command.
Here is a valid query for alerting on messages that contain the text “Exception”:
1 2 3
filter @message like /Exception/ | stats count(*) as exceptionCount by bin(1h) | sort exceptionCount desc
Cross-Account Observability
The CloudWatch plugin enables you to monitor and troubleshoot applications across regions and accounts. With cross-account observability, you can seamlessly search, visualize, and analyze metrics and logs without worrying about account boundaries.
To use this feature, configure a monitoring and source account under CloudWatch settings in the AWS Console, then add the necessary IAM permissions as described above.