This article describes how to visualize and monitor OS metrics for Amazon RDS instances using Grafana. We use CloudWatch as a data source, and Grafana to query CloudWatch API in real-time to get data. The setup instructions include just four quick steps (assuming you already use Grafana).
1. Create an IAM user on the AWS panel, and attach the managed policy “CloudWatchReadOnlyAccess”.
2. Put the credentials in the file “~grafana/.aws/credentials”:
[default] aws_access_key_id = youraccesskeyid aws_secret_access_key = yoursecretaccesskey
3. Add CloudWatch as the data source to Grafana, with the name “CloudWatch” (the pre-defined graphs rely on this name) and choose any region. Other fields can be left blank.
Finally, choose the AWS region, select the DB Instance, and see the graphs. I have created my db.t2.micro instance on us-west-2 region, and named it “blackbox” to show these screenshots:
The dashboard uses 60s resolution and shows an average over each datapoint. An exception is the “CPU Credit Usage” graph, which has a five min. average and interval length. All data is fetched in real-time and not stored anywhere.
This dashboard can be used with any Amazon RDS DB engine, including MySQL, Aurora, etc.
Amazon provides one million CloudWatch API requests each month at no additional charge. Past this, it costs $0.01 per 1,000 requests. The pre-defined dashboard performs 15 requests on each refresh and an extra two on initial loading.
More Monitoring for RDS
“Amazon RDS OS Metrics” dashboard will also be a part of the next release of Percona Monitoring and Management (PMM). If you are already using it, you can use the same instructions as in this blog post, but on step two you have to create a local credentials file (say /root/aws_credentials) and share it with pmm-server container by adding “-v /root/aws_credentials:/usr/share/grafana/.aws/credentials -e HOME=/usr/share/grafana” with the create command.
To enable MySQL metrics and query analytics for Amazon RDS using PMM platform, follow this guide.