SQLNirvana by Pyro

Blog › aws · mysql · postgresql

Monitoring Amazon RDS for MySQL and PostgreSQL: what CloudWatch tells you and what it doesn't

CloudWatch shows how the instance is doing. It doesn't tell you why. How to combine instance metrics with database-level checks, and how parameter groups work.

With Amazon RDS and Aurora, AWS runs the operating system, backups and patching. You still own everything inside the database: settings, queries, indexes, locks and schema. Monitoring needs to cover both layers.

What CloudWatch gives you

RDS publishes instance metrics to CloudWatch, typically every minute:

MetricWatch for
CPUUtilizationSustained high CPU usually means expensive queries, not too small an instance
FreeableMemorySteady decline toward zero, or the instance starting to swap (SwapUsage)
ReadIOPS / WriteIOPSHitting the volume's provisioned or baseline IOPS
FreeStorageSpaceRunning out of disk stops writes; turn on storage autoscaling or alert early
DatabaseConnectionsApproaching max_connections, or sudden jumps
ReplicaLagRead replicas falling behind

These tell you that something is wrong. They don't tell you which query, which lock, or which setting.

What you still need from inside the database

You can't install software on an RDS host, so database-level monitoring runs from another machine in the same VPC and connects over the network.

Parameter groups: how settings change on RDS

On RDS you don't edit my.cnf or postgresql.conf. Settings live in a DB parameter group attached to the instance.

Right-sizing

CloudWatch history is also how you decide whether an instance is the right size. Look at the 95th percentile of hourly maximum CPU and the minimum freeable memory over two weeks. If CPU rarely passes 30% and plenty of memory stays free, one size down halves the instance cost. Also look at Graviton instance classes and gp3 storage, which are usually cheaper than their older equivalents.

How SQLNirvana handles RDS

Run the agent on a small VM in the VPC with --remote. It collects database-level data over the network. Then link the instance in SQLNirvana with a read-only IAM role (cross-account, with an external ID; no AWS keys are shared). SQLNirvana reads CloudWatch for CPU, memory, IOPS and storage, and the Savings tab uses 14 days of it to suggest a size. With the optional write permission, approved settings are applied through your custom parameter group.

Let SQLNirvana watch it for you

Health, tuning, security and upgrade checks every minute. Free for one server.

Start free