intermediate
CloudWatch
Collect logs, metrics, alarms, dashboards, and events for AWS workloads while managing retention, cardinality, and alert noise.
CloudWatch collects metrics, logs, alarms, and events for AWS workloads. Node.js services on Lambda, ECS, or EC2 should emit structured JSON logs to stdout; the agent or platform ships them to log groups with retention policies.
| Signal | Tooling | |--------|---------| | Metrics | Custom namespaces, EMF from Lambda, built-in AWS metrics | | Logs | Log groups, metric filters, Logs Insights queries | | Alarms | SNS/Auto Scaling actions on thresholds | | Dashboards | Cross-service operational view |
Watch cardinality: high-cardinality labels in custom metrics inflate cost. Define SLO-driven alarms (error rate, latency p99, queue age) instead of paging on every CPU blip.
On interviews: Logs Insights query basics, metric filters versus embedded metric format, composite alarms, and how CloudWatch differs from APM tools like X-Ray or third-party vendors.
Common pitfalls: infinite log retention bills; logging secrets or PII; alarms without runbooks; relying only on default AWS metrics while app errors stay invisible.
The trade-off is native integration and low friction versus limited tracing depth and query ergonomics compared with dedicated observability stacks.
Checklist:
- Structured logs with request IDs and service name.
- Set log retention per environment.
- Alarm on user-visible symptoms, not only infrastructure CPU.
- Link dashboards to on-call runbooks and SNS topics.