Skip to the page

Foundations: IAM, storage, databases, monitoring · mid

CloudWatch logs, metrics, alarms and cost alerts

CloudWatch collects logs (log groups, searchable with Logs Insights), metrics (built-in and custom) and alarms that fire when a metric breaches a threshold for M out of N periods, and AWS Budgets warns you before costs surprise you.

The notes

What you must know

  • Logs: each service writes to log groups; set retention (the default is to keep logs forever, which costs money); query with CloudWatch Logs Insights.
  • Metrics: built-in per service (Lambda errors and duration, ALB 5xx and target response time, RDS CPU and connections); custom metrics via the API or Embedded Metric Format in logs.
  • Alarms: threshold + period + 'M of N datapoints' to avoid flapping; actions notify SNS (email, Slack, PagerDuty) or trigger auto scaling.
  • Tracing: X-Ray shows request paths across services; AWS put the X-Ray SDKs and daemon in maintenance mode in 2026 and recommends OpenTelemetry (ADOT) instrumentation.
  • CloudTrail records API calls (who changed what) for security and audits.
  • Cost: AWS Budgets alerts, Cost Explorer, tags per service and team; common surprises are NAT Gateway data, logs, idle resources and data transfer.

The red pen

Common traps: mistake → fix

  • Mistake: Alarm on a single datapoint

    Fix: brief spikes page people at night; use M of N periods.

  • Mistake: Logs are free to keep

    Fix: ingestion and storage are billed; set retention.

Easy to hard

Questions interviewers ask, easy to hard

  1. How do you monitor a service on AWS?
  2. How do you set an alarm that does not flap?
  3. How do you find all errors for one request in CloudWatch?
  4. How do you avoid a surprise AWS bill?

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview