Skip to content

Monitoring guide

AWS monitoring with CloudWatch metrics

AWS publishes metrics for every managed service in CloudWatch. The trick is choosing the few that predict user impact and putting them next to your application data.

3 min read11 sectionsUpdated

On this page

Key points

  • Pull CloudWatch metrics by namespace into one place with your app telemetry.
  • Use a read-only IAM user with cloudwatch:ListMetrics and GetMetricData.
  • Combine managed-service metrics with traces from your code.
  • Check from outside too: AWS being up does not mean your app is.

Metrics worth watching by service

Service (namespace)MetricsWorry when
EC2 (AWS/EC2)CPUUtilization, StatusCheckFailed, CPUCreditBalanceStatus checks fail; credits run out on burstable instances
RDS (AWS/RDS)CPUUtilization, FreeableMemory, FreeStorageSpace, DatabaseConnections, ReplicaLagStorage low; connections near max; lag
ALB (AWS/ApplicationELB)HTTPCode_Target_5XX_Count, TargetResponseTime, UnHealthyHostCount5xx up; unhealthy hosts > 0
SQS (AWS/SQS)ApproximateNumberOfMessagesVisible, ApproximateAgeOfOldestMessageAge of oldest message growing
Lambda (AWS/Lambda)Errors, Throttles, Duration, ConcurrentExecutionsThrottles or errors > 0

A least-privilege IAM policy

vitalrix-cloudwatch-read.jsonjson
{
  "Version": "2012-10-17",
  "Statement": [
    { "Effect": "Allow", "Action": ["cloudwatch:ListMetrics", "cloudwatch:GetMetricData"], "Resource": "*" }
  ]
}

AWS monitoring with VitalRix

The AWS CloudWatch integration pulls metrics (GetMetricData) from the namespaces you choose, for example AWS/EC2, AWS/RDS, AWS/ApplicationELB (up to 10), into VitalRix every few minutes at a 60- or 300-second period, so dashboards and alert rules can use them. It needs an access key for an IAM user with only the two permissions above; the secret is stored encrypted. Combine it with APM for your services, uptime checks from outside AWS, and the AWS Lambda and ECS Fargate guides. See integrations.

Alerts to start with

  • EC2 StatusCheckFailed above 0 for 2 periods.
  • RDS FreeStorageSpace below 15%, DatabaseConnections above 80% of the limit, ReplicaLag above your RPO.
  • ALB UnHealthyHostCount above 0, HTTPCode_Target_5XX_Count rising, TargetResponseTime p95 above target.
  • SQS ApproximateAgeOfOldestMessage above your processing target.
  • Lambda Errors or Throttles above 0.
  • An uptime check on the public URL from outside AWS.

Keeping CloudWatch costs predictable

GetMetricData is billed per metric requested, and detailed monitoring adds cost per instance. Pull only the namespaces you chart or alert on, prefer 300-second periods unless you need minute-level detail, and remove namespaces you stop using. Logs are billed separately per GB ingested and stored.

Tags and naming

Use consistent AWS tags (service, environment, team) and the same names in OpenTelemetry resource attributes. When a CloudWatch metric and a trace refer to the same service by the same name, dashboards and incidents can put them side by side.

Frequently asked questions

Does pulling CloudWatch metrics cost money?

GetMetricData requests are billed by AWS per metric requested. Limit namespaces to what you use and prefer a 300-second period unless you need 60.

Can I use CloudWatch alarms instead?

You can, but alerts then live in a separate tool from your application data. Keeping both in one place makes incidents faster to diagnose.

Check it now, free

  • The three pillars of observability: Logs, metrics and traces compared: what each pillar of observability is good at, what it costs, and how to link them so one alert leads to the cause.
  • What is metric cardinality?: High-cardinality metrics explained: how labels multiply time series, why it hurts cost and performance, examples of bad labels and how to keep detail in traces.
  • The RED method: The RED method explained: rate, errors and duration for every service, how to compute each from traces, a dashboard layout and the alerts worth setting.
  • The AWS S3 outage of February 2017, explained: How a mistyped command during debugging took Amazon S3 in us-east-1 offline for about four hours on 28 February 2017, why recovery was slow, and the lessons.
  • Azure monitoring for applications: Monitor applications on Azure: App Service, AKS and Azure SQL metrics that matter, collecting Azure Monitor metrics with the OpenTelemetry Collector.
  • How to monitor Fly.io: How to monitor apps on Fly.io: multi-region uptime checks, machine health, the built-in Prometheus metrics, Postgres clusters, OpenTelemetry traces and alerts.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.