AWS CloudWatch Explained: Logs, Metrics, Alarms, Dashboards, and Best Practices
AWS CloudWatch is the first place most AWS teams look when something slows down, fails, scales unexpectedly, or starts costing too much. It collects metrics, logs, alarms, dashboards, traces, and newer analytics data so you can see what your AWS resources and applications are doing in near real time.
That sounds simple. In practice, CloudWatch becomes either your best operational tool or a noisy bill generator. The difference is how you structure logs, choose metrics, set alarms, and build dashboards.

What Is AWS CloudWatch?
Amazon CloudWatch is AWS's primary observability service. It monitors AWS resources such as EC2, EBS, Elastic Load Balancing, Lambda, API Gateway, and RDS. It also accepts custom telemetry from applications, containers, scripts, and on-premises systems.
CloudWatch now goes well beyond basic monitoring. Recent AWS releases position it as a unified data store for observability, security, audit, and compliance data. That includes organization-wide telemetry collection, S3 Tables using Apache Iceberg, AI-assisted investigations, Database Insights, and support for open telemetry patterns such as OTLP and PromQL.
If you are building cloud operations skills, CloudWatch belongs right beside IAM, VPC, EC2, Lambda, and security monitoring in your learning path. It pairs naturally with Global Tech Council's AWS training, cloud computing certification, cybersecurity certification, and DevOps learning resources.
AWS CloudWatch Metrics
Metrics are numeric time-series data. CPU utilization, network throughput, disk read operations, Lambda duration, API Gateway 5xx errors, and RDS database connections are common examples.
Many AWS services publish metrics automatically. EC2 basic monitoring includes selected metrics at 5-minute intervals, plus status check metrics at 1-minute intervals. Detailed monitoring, which is paid, gives 1-minute granularity for EC2 metrics. For production systems where a 4-minute blind spot matters, detailed monitoring is usually worth it.
CloudWatch stores metric data for up to 15 months. That matters for capacity planning. You can compare this month's Monday traffic with the same period last quarter instead of guessing from the last few hours.
Custom Metrics and High-Resolution Data
You can publish custom metrics from applications or scripts. CloudWatch supports high-resolution metrics down to 1 second. Use that carefully. One-second metrics help with short-lived spikes, queue depth, request latency, and trading or IoT workloads. They are wasteful for slow-moving values such as daily user counts.
A practical warning: do not use unbounded values as metric dimensions. A request ID, customer ID, session ID, or container ID creates high cardinality and painful costs. Use dimensions such as service, environment, region, endpoint, and status code instead.
CloudWatch's newer high-cardinality metrics store and OTLP ingestion support up to 150 labels per metric, compared with the traditional 30-dimension custom metric limit. That helps Kubernetes, microservices, and OpenTelemetry users. Still, more labels do not mean better monitoring. Keep the labels you will actually query.
AWS CloudWatch Logs
CloudWatch Logs stores log events in log groups and log streams. A log group usually represents an application, Lambda function, service, or system component. A log stream is often tied to a specific instance, container, execution environment, or source.
You can collect logs from AWS services, the CloudWatch agent, and application libraries. Managed connectors can bring in audit data from tools such as Okta, CrowdStrike, and GitHub, which makes CloudWatch more useful for security and compliance teams.
Logs Insights Query Example
CloudWatch Logs Insights is where logs become useful. This query finds the latest application errors:
fields @timestamp, @message
| filter @message like /ERROR|Exception/
| sort @timestamp desc
| limit 50For Lambda, I often start with this query when debugging memory or cold start issues:
fields @timestamp, @message
| filter @message like /REPORT/
| parse @message "*Duration: * ms Billed Duration: * ms Memory Size: * MB Max Memory Used: * MB*" as requestId, duration, billedDuration, memorySize, maxMemoryUsed, rest
| sort @timestamp desc
| limit 20The detail beginners miss: Lambda logs include Max Memory Used in the REPORT line. If a function is configured for 128 MB and consistently uses 120 MB, latency spikes may be memory pressure, not code complexity.
CloudWatch can now query across up to 10,000 log groups in a single query. Logs Insights concurrency has also increased from 30 to 100 concurrent queries. These numbers matter if you automate investigations or run dashboards that query logs directly.
Log Storage and Cost Choices
Set retention policies. Seriously. The default habit of keeping everything forever is expensive and rarely defensible. Keep hot operational logs in the Standard class, move low-access data to Infrequent Access where appropriate, and align retention with compliance rules.
Recent CloudWatch enhancements also expose data as S3 Tables in Apache Iceberg format. That makes long-term analytics easier, since teams can query observability data with AWS and third-party analytics tools without duplicating every log stream into another system.
AWS CloudWatch Alarms
CloudWatch alarms watch metrics and trigger actions when conditions are met. An alarm can notify an SNS topic, invoke Lambda, send events to EventBridge, or start automated remediation.
Common alarms include:
- EC2 CPU above 85 percent for 10 minutes
- ALB HTTPCode_Target_5XX_Count above a baseline
- RDS FreeStorageSpace below a safe threshold
- Lambda Errors greater than zero for a critical function
- SQS ApproximateAgeOfOldestMessage growing for several periods
Static thresholds are fine for stable systems. For traffic that varies by time of day, anomaly detection works better. A checkout API doing 30 requests per second at 3 a.m. may be suspicious. The same value at noon may be normal.
Recent CloudWatch updates also support creating alarms directly from log query results. That removes the old extra step where you had to define a metric filter first. For security events, application exceptions, and compliance checks, this is a cleaner workflow.
AWS CloudWatch Dashboards
Dashboards are shared views of system health. Build them around services, not AWS product names. A useful payments dashboard might show API latency, 5xx errors, Lambda duration, DynamoDB throttles, SQS queue age, and error logs on the same screen.
A weak dashboard has 40 graphs and no decision value. A good one answers three questions fast:
- Are users affected?
- Which dependency is failing?
- What should the on-call engineer check next?
Use text widgets to document runbook links, alarm meanings, and ownership. That small habit saves time during incidents, especially when the person on call did not build the system.
CloudWatch AI, Traces, and Advanced Analytics
CloudWatch now includes more AI-assisted operations features. CloudWatch Investigations can help build incident timelines and suggest root causes. Database Insights uses machine learning to identify database performance bottlenecks and recommend fixes.
For distributed systems, span analytics and Application Map help you see service dependencies and latency paths. If a request touches API Gateway, Lambda, a container service, RDS, and a third-party endpoint, metrics alone will not tell the whole story. You need traces.
My view: AI-assisted observability is useful for triage, not a substitute for clean instrumentation. If your services log plain text blobs with no request ID, user journey, endpoint, or error class, AI features will still struggle. Garbage in, polished garbage out.
AWS CloudWatch Monitoring Best Practices
1. Use Structured Logs
Log JSON where possible. Include fields such as service, environment, requestId, userAction, statusCode, latencyMs, and errorType. Do not log secrets. CloudWatch data protection features help, but prevention is better.
2. Separate Signal From Noise
Alert on symptoms before causes. Page someone for user-facing error rate, severe latency, failed payments, or queue age. Send low-priority notifications for single-instance CPU spikes unless they affect service health.
3. Choose the Right Metric Resolution
Use 1-minute EC2 detailed monitoring for production workloads that need quick reaction. Use 1-second custom metrics only where short spikes matter. For many batch and back-office workloads, 5-minute data is enough.
4. Control Cardinality
High-cardinality metrics are powerful, especially with OTLP and PromQL support. They are also easy to abuse. Avoid labels that grow without limit. Your future self, and your finance team, will thank you.
5. Automate the First Response
Connect alarms to EventBridge and Lambda for safe remediation. Restart a stuck worker, scale a consumer group, or roll back a known bad deployment. Keep automation narrow and auditable. Never let a generic script delete production resources because one metric crossed a threshold.
6. Design Dashboards for Ownership
Every dashboard should have an owner. Every graph should have a reason to exist. If nobody knows what action to take when a line changes, remove it or rewrite the runbook.
7. Plan Retention Early
Define retention by log type. Application debug logs may need days. Security audit logs may need months or years. Use Infrequent Access and Iceberg-backed S3 Tables where they fit compliance and analysis needs.
Common AWS CloudWatch Mistakes
- Expecting EC2 memory metrics by default: CloudWatch does not publish EC2 memory usage automatically. Install and configure the CloudWatch agent.
- Creating alarms without evaluation windows: One bad datapoint can wake people up. Use multiple periods unless the metric is truly critical.
- Logging raw stack traces only: Add structured context so you can filter by customer action, endpoint, or deployment version.
- Keeping every log forever: Retention without policy becomes cost without value.
- Using dashboards as wall art: If a dashboard does not guide action, it is decoration.
Final Takeaway
AWS CloudWatch is no longer just a metrics and logs console. It is becoming an observability data platform for operations, security, compliance, application performance, and AI-assisted incident response.
Start with the basics: publish the right metrics, structure your logs, create meaningful alarms, and build service-level dashboards. Then add OpenTelemetry, span analytics, Database Insights, and AI investigations where they solve a real problem.
Your next step: build a small AWS project, instrument it with CloudWatch metrics and logs, write three Logs Insights queries, and create one alarm that triggers an SNS notification. If you are preparing for a cloud role, pair that lab with Global Tech Council's AWS, cloud computing, DevOps, or cybersecurity certification resources.
Related Articles
View AllAws
AWS Security Best Practices: IAM, Encryption, Monitoring, and Compliance Essentials
Learn AWS security best practices for IAM, encryption, monitoring, and compliance, with practical controls for safer cloud workloads.
Aws
AWS KMS Guide: Encryption Keys, Data Protection, and Cloud Security Best Practices
A practical AWS KMS guide covering key types, envelope encryption, rotation, CloudTrail monitoring, post-quantum updates, and cloud security controls.
Aws
AWS CloudFormation Guide: Infrastructure as Code Templates, Stacks, and Best Practices
Learn AWS CloudFormation templates, stacks, StackSets, Hooks, Express mode, and practical IaC best practices for safer AWS deployments.
Trending Articles
The Role of Blockchain in Ethical AI Development
How blockchain technology is being used to promote transparency and accountability in artificial intelligence systems.
AWS Career Roadmap
A step-by-step guide to building a successful career in Amazon Web Services cloud computing.
Top 5 DeFi Platforms
Explore the leading decentralized finance platforms and what makes each one unique in the evolving DeFi landscape.