CI/CD and monitoringIntermediate24 min read

What Does CloudWatch metric Mean?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security
On This Page

Quick Definition

A CloudWatch metric is like a check engine light for your AWS cloud resources. It tracks a specific value over time, such as CPU usage of a virtual server or the number of running database connections. These metrics help you see how your system is doing and alert you when something is wrong. You can set alarms based on them to keep your apps healthy and efficient.

Commonly Confused With

CloudWatch metricvsCloudWatch Logs Insights

A CloudWatch metric is a numerical value over time, while CloudWatch Logs Insights is a query engine used to analyze log text data. Metrics give you numbers; Logs Insights gives you patterns in strings. For example, you might use a metric to see CPU percentage, but Logs Insights to search for ERROR messages.

You would use a metric to track that CPU is at 90%, but you would use Logs Insights to find out that the error message Database timeout appears 200 times in the last 5 minutes.

CloudWatch metricvsCloudWatch Alarm

A CloudWatch metric is the raw data point or time series. A CloudWatch alarm is an object that watches a metric and takes an action (like sending an email) when the metric crosses a threshold. The metric is the thing being measured; the alarm is the rule that reacts to that measurement.

If CPU Utilization is the metric, an alarm could say: if CPU > 80% for 5 minutes, then send an SNS notification. You need the metric first; the alarm uses it.

CloudWatch metricvsAWS Lambda Metrics

AWS Lambda automatically publishes metrics like Invocations, Duration, and Errors to CloudWatch under the AWS/Lambda namespace. These are specific to Lambda functions. CloudWatch metric is a general concept; Lambda metrics are just one specific set of metrics published by the Lambda service.

When you look at the Duration metric for a Lambda function, you are looking at a specific CloudWatch metric. The same CloudWatch service also handles EC2 CPU metrics, but they are different namespaces.

Must Know for Exams

The AWS Certified Developer – Associate exam (DVA-C02) places significant emphasis on CloudWatch metrics as part of the Monitoring and Troubleshooting domain. This is a primary objective. You are expected to know not only what a metric is, but how to publish custom metrics, how to set up alarms that trigger actions, how to retrieve metric data using the AWS SDK or CLI, and how to interpret statistics like Average, Sum, and Percentile.

Exam questions will present scenarios where an application is experiencing intermittent slowdowns. You need to decide which CloudWatch metrics to examine, such as CPUUtilization, Memory utilization (custom metric, since AWS does not track memory by default), and RDS Connections. You will also be tested on the differences between basic monitoring (5-minute intervals for EC2) and detailed monitoring (1-minute intervals), and when to enable the latter (for Auto Scaling or when you need faster detection).

Another common exam topic is the use of dimension filters. You may be asked how to aggregate metrics across multiple instances that all share the same Auto Scaling Group. The correct answer often involves filtering by the AutoScalingGroupName dimension.

You must also know the default retention periods: fine-grained metrics (less than 60 seconds) last 3 hours, 1-minute data lasts 15 days, 5-minute data lasts 63 days, and 1-hour data lasts 15 months. Questions about retrieving historical data for a compliance audit will test this. Another frequent question pattern involves custom metrics.

You might have a scenario where a developer needs to monitor the number of active user sessions or the length of an order processing queue. You must know that you use the PutMetricData API to send these custom metrics, and that they are stored in the CloudWatch namespace you choose. You also need to know about metric resolution: standard (1-minute) versus high-resolution (1-second) custom metrics.

High-resolution metrics cost more but allow faster alarms. Finally, you will encounter questions about CloudWatch Logs metric filters, which allow you to extract metrics from log data. For example, counting the number of ERROR log entries per minute and creating a CloudWatch alarm when that crosses a threshold.

This is a common troubleshooting scenario that combines log analysis with metric-based alerting. For the DVA-C02 exam, CloudWatch metrics are everywhere. You need to be comfortable with the entire lifecycle: publishing, viewing, alarming, and acting on metric data.

Simple Meaning

Think of CloudWatch metrics as the dashboard of your car, but for your cloud applications and services. When you drive a car, you have gauges showing speed, engine temperature, fuel level, and oil pressure. Each gauge gives you a number at a moment in time: 60 miles per hour, 90 degrees Celsius, half a tank, normal oil pressure.

Over your trip, these numbers change; they have a history. A CloudWatch metric works the same way. It measures something specific about one of your AWS resources, like an Amazon EC2 virtual machine, an RDS database, or even a custom part of your own application.

For example, the CPU Utilization metric for an EC2 instance will record a percentage value every minute. That value goes up if your web app is getting a lot of traffic, and it goes down at night when usage is low. AWS stores these data points over hours, days, or even months.

This creates a timeline you can look at later. If you see the CPU metric staying at 95% for 30 minutes, you might decide to add more servers to handle the load. If memory usage on a database keeps climbing, you might plan to upgrade to a larger instance.

Metrics are the foundation of monitoring and observability in AWS. Without metrics, you are flying blind. You would not know if your application is healthy, if it is about to crash, or if it is wasting money by using more resources than needed.

CloudWatch lets you collect metrics from many services, set alarms to notify you when a metric crosses a dangerous threshold, and even trigger automated actions, like launching a new EC2 instance, when a metric hits a critical value. So, in plain terms, a CloudWatch metric is a single, measurable data point that tells you how a piece of your cloud system is behaving at a given moment. When you look at many metrics together over time, you get a full picture of your system’s health and performance.

Full Technical Definition

In AWS, a CloudWatch metric is a fundamental concept within the Amazon CloudWatch monitoring service. A metric represents a time-ordered set of data points that are published to CloudWatch over a specific period. Each metric is uniquely defined by a combination of a namespace, a metric name, and zero or more dimensions.

The namespace is a container for metrics. For example, all Amazon EC2 metrics reside in the AWS/EC2 namespace, while Amazon RDS metrics use the AWS/RDS namespace. Custom metrics that you publish from your own application can use any namespace you choose, such as MyCompany/WebApp.

The metric name identifies the specific measurement, like CPUUtilization, NetworkIn, DiskReadBytes, or a custom metric name like SuccessfulLogins. Dimensions are key-value pairs that further refine the metric. For instance, an EC2 metric might have a dimension InstanceId with value i-1234567890abcdef0.

This allows you to see the CPU usage for that specific server. You can also combine dimensions, such as InstanceId and AutoScalingGroupName, to analyze metrics across a group of servers. CloudWatch stores metrics for a default retention period: data points with a period of less than 60 seconds are available for 3 hours, 1-minute data points for 15 days, 5-minute data points for 63 days, and 1-hour data points for 455 days (15 months).

You can also use CloudWatch Logs and Contributor Insights to derive custom metrics from log data. Metrics are published to CloudWatch via the PutMetricData API call. Each call can include up to 20 metrics.

Metrics are aggregated and stored, and you can retrieve them via the GetMetricData or GetMetricStatistics API calls for analysis and visualization. Alarms can be created on metrics. An alarm watches a single metric over a specified time period, and performs one or more actions based on the value of the metric relative to a threshold over a number of time periods.

Actions can include sending a notification via Amazon SNS, executing an Auto Scaling policy, or triggering an EC2 action. CloudWatch metrics also support statistics such as Sum, Average, Minimum, Maximum, SampleCount, and percentile values (p99, p90, etc.).

Understanding these statistics is critical for exam questions: for example, using Average for normal distribution or Sum for counts of events. Metrics can also be exported to other services, such as Amazon Managed Service for Prometheus or third-party tools, for deeper analysis. The CloudWatch Metrics interface within the AWS Management Console provides a visual graph builder that lets you plot multiple metrics from different namespaces on a single graph, which is a common exam scenario for troubleshooting performance issues across a stack (EC2, RDS, Application Load Balancer).

Finally, CloudWatch Metrics are the backbone of CloudWatch Dashboards, which allow you to create custom views of your infrastructure’s health.

Real-Life Example

Imagine you run a small lemonade stand at a busy park. You have a few important numbers to track: how many cups of lemonade you sell each hour, the temperature outside, how full your lemonade pitcher is, and how much cash is in your cash box. Each of these numbers is like a CloudWatch metric.

The number of cups sold per hour is like a custom metric you push to CloudWatch. The outside temperature is like a built-in metric from a weather service (similar to an AWS managed metric). The pitcher level is like a disk space metric on a server.

The cash box total is like a billing metric. Each metric is just a single number at a specific time. But when you write down these numbers every hour for a week, you get a time series.

You can look at the data and see that at 2 PM on Saturday, you sold 50 cups, the temperature was 95 degrees, your pitcher was nearly empty, and you had $150 in the box. That is a snapshot. Now, imagine you set an alarm: if the pitcher level drops below 10% (threshold), and it stays there for 5 minutes (evaluation period), you want a notification to run to the kitchen for more lemonade (SNS notification).

That is exactly how a CloudWatch alarm works on a metric. Also, if the temperature metric stays above 90 degrees for more than 2 hours, you might automatically add more ice to your drink cooler (like triggering an Auto Scaling action to add more EC2 instances). The key insight is that a single metric is almost useless by itself.

It is the combination of metrics over time, and the alarms and actions tied to them, that give you real control. Without these metrics, you would only realize the pitcher was empty when a customer asked for lemonade and you had none. With metrics, you see the trend and act before it becomes a problem.

That is what CloudWatch metrics do for your cloud infrastructure: they give you a continuous stream of vital signs so you can keep your application running smoothly.

Why This Term Matters

In a real-world IT environment, especially one that runs on AWS, applications are not static. They have peaks and valleys. Traffic spikes during a marketing campaign. A database query gets slower as data grows.

A rogue process consumes 100% CPU. Without monitoring, these events cause downtime, slow response times, or even data loss. CloudWatch metrics are the lifeblood of any operational strategy because they provide the raw data needed to make decisions.

You cannot fix what you cannot measure. Metrics allow you to establish a baseline of normal behavior for your system. Once you know what CPU usage looks like during a normal Tuesday afternoon, you can set an alarm to trigger when it deviates significantly, which often indicates a problem.

For a DevOps engineer or a developer preparing for the AWS Developer Associate exam, understanding CloudWatch metrics is essential for building resilient and cost-efficient applications. You will use metrics to determine why an application is slow by correlating high CPU on the EC2 instance with high latency on the Application Load Balancer and a high number of database connections. You will use metrics to set up Auto Scaling policies that add more instances when CPU crosses 70% and remove them when it drops below 30%, saving money during low traffic periods.

Without metrics, scaling would be manual or impossible. Metrics are also critical for cost optimization. You can track the size of an SQS queue to see if messages are piling up, or monitor the throttled requests of a DynamoDB table to know if you need to increase throughput.

In a production environment, CloudWatch metrics are often integrated with incident management tools like PagerDuty or Opsgenie. When a metric breach occurs, an on-call engineer is alerted and can investigate the dashboard. Metrics also support compliance and auditing; you can prove that your system was running at a certain capacity on a given date.

In short, CloudWatch metrics matter because they transform AWS from a black box into a transparent, observable system that you can control, optimize, and troubleshoot with precision.

How It Appears in Exam Questions

CloudWatch metric questions on the AWS Developer Associate exam fall into several distinct patterns. The most common is the scenario-based question: you are given an application description, and you need to identify the correct metric to monitor or the correct way to set up an alarm. For example, “A developer notices that an EC2 instance runs out of memory once a week.

What metric should the developer publish to Amazon CloudWatch so that an alarm can be set?” The answer is to publish a custom metric for MemoryUtilization, because Amazon does not monitor memory by default. Another pattern is the alarm action question.

The question might say, “An Auto Scaling group launches new instances when CPUUtilization exceeds 70%. The developer wants to be notified when the group scales out. How can this be achieved?

” The answer is to create a CloudWatch alarm on the CPUUtilization metric for the Auto Scaling group, with a greater than 70 threshold, and add an SNS action to send a notification. The alarm evaluation periods and datapoints to alarm are often tested: “An alarm should trigger only if CPUUtilization is above 80% for 5 consecutive data points with a 1-minute period.” This means the evaluation period is 5 minutes, and the threshold is 80.

The question might ask about the effect of a single data point not crossing the threshold, or the difference between breaching and OK states. Another category of question is about retrieving metrics. You might be asked, “Which CLI command retrieves the CPUUtilization metric for a specific instance over the last 24 hours?

” The answer is `aws cloudwatch get-metric-statistics` with the correct namespace, metric name, dimensions, and period. You might also be asked to interpret a graph showing multiple metrics, such as a spike in latency on the load balancer correlating with a spike in database connections, and identify the root cause. Troubleshooting questions are common: “An application is slow.

CloudWatch shows high latency on the ALB, high CPU on EC2, and a high number of connections on RDS. What is the most likely cause?” The answer is a database bottleneck due to inefficient queries.

There are also configuration questions regarding metric filters in CloudWatch Logs. For example, “A developer wants to count the number of 404 errors from an application log file and set an alarm if the count exceeds 10 in 5 minutes. How should this be configured?

” The correct process is to create a log group, a metric filter that matches the pattern, and then create an alarm on that metric. Finally, you may encounter questions about cost: “Which change would increase the cost of CloudWatch custom metrics?” Enabling high-resolution metrics (1-second) would increase cost compared to standard 1-minute resolution.

Understanding these patterns, and practicing with the AWS console or CLI, is essential for exam success.

Practise CloudWatch metric Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

Ben is a developer at a startup that runs a popular e-commerce site on AWS. They use a single EC2 instance behind an Application Load Balancer (ALB) with a managed MySQL database on RDS. One day, customers start complaining that the site is slow, especially during flash sales.

Ben opens the CloudWatch console to investigate. He first looks at the CPUUtilization metric for his EC2 instance (metric name: CPUUtilization, namespace: AWS/EC2, dimension: InstanceId). He sees that during the flash sale, CPUUtilization spikes to 95% for 10 minutes.

He then checks the NetworkIn and NetworkOut metrics for the same instance, which show that data transfer is very high. Next, he looks at the ALB metrics: RequestCount and TargetResponseTime. The TargetResponseTime is over 3 seconds at peak, which is bad.

He then examines the RDS instance metrics: DatabaseConnections and CPUUtilization. The DatabaseConnections jumps to 200 (far above the typical 50), and RDS CPU is pegged at 80%. Ben now has a clear picture: the flash sale brings many users, causing many requests to the web server, which in turn opens many database connections.

The database becomes a bottleneck, slowing all queries. To fix this, Ben decides to implement Auto Scaling for the EC2 instance, using a scale-out policy based on CPUUtilization greater than 70% for 5 minutes. He also adds an RDS read replica to handle read-heavy queries.

He sets up a CloudWatch alarm on the ALB 5xxErrorRate metric to notify him if errors rise above 1%. Finally, he creates a custom metric for SessionCount in his application code and pushes it to CloudWatch using the PutMetricData API, so he can monitor traffic in real time. With these metrics, Ben now has full visibility and automated response to future traffic spikes.

Common Mistakes

Assuming AWS automatically monitors memory usage of EC2 instances.

AWS does not monitor memory inside EC2 instances by default. MemoryUtilization is a custom metric that must be explicitly published from within the instance using a script or agent.

If you need to track memory usage, install the CloudWatch agent or write a cron job to push the value via the PutMetricData API.

Setting an alarm with only 1 datapoint to trigger, causing frequent false alarms.

A single spike in CPU might be temporary and not indicate a real problem. Alarms should evaluate multiple consecutive datapoints (e.g., 2 out of 3 periods or 5 out of 5) to reduce noise.

Configure alarm evaluation periods to be at least 2 or 3 consecutive datapoints above the threshold before triggering an alarm.

Filtering metrics by InstanceId when the instance has been terminated and a new one launched, causing the alarm to not work.

If an alarm is tied to a specific InstanceId dimension, and that instance is terminated, the alarm loses its target. The new instance has a different InstanceId.

Use dimensions like AutoScalingGroupName or a custom tag to group all instances in an Auto Scaling group, so the alarm applies to any instance that meets the dimension criteria.

Using the Sum statistic for CPUUtilization instead of Average.

Sum of CPUUtilization over a period does not make sense because CPU is a percentage. For example, summing 70% over 5 minutes gives 350%, which is not meaningful. Average or Max are more appropriate.

For CPUUtilization, use the Average or Maximum statistic. Use Sum only for count-based metrics like RequestCount or ErrorCount.

Forgetting to enable detailed monitoring for Auto Scaling metrics when needed.

Without detailed monitoring (1-minute intervals), the Auto Scaling group may take longer to detect high CPU, leading to slower scale-out actions and potential performance issues.

Enable EC2 detailed monitoring (set Monitoring to Enabled) when using Auto Scaling that reacts to CloudWatch metrics, to ensure faster response times.

Exam Trap — Don't Get Fooled

{"trap":"The exam states that a user wants to monitor the memory usage of an EC2 instance. The first answer option is a CloudWatch alarm on the MemoryUtilization metric that comes from the AWS/EC2 namespace. Many learners choose this because they assume memory is a built-in metric."

,"why_learners_choose_it":"Learners think that because CPUUtilization and DiskReadOps are automatically available for EC2, memory must be as well. They do not realize that memory metrics must be explicitly sent as custom metrics.","how_to_avoid_it":"Always remember that EC2 does not publish memory or disk usage to CloudWatch by default.

Those are custom metrics. The correct approach is to install the CloudWatch agent on the instance, or use a script that calls PutMetricData. Also, the namespace for custom metrics is not AWS/EC2 but your own custom namespace."

Step-by-Step Breakdown

1

Identify What to Monitor

First, determine which resource or application aspect you need to observe. For an EC2 instance, that might be CPU usage. For a custom application, it could be the number of active users. This step defines the metric name and namespace.

2

Collect the Data Point

For AWS-managed services like EC2 or RDS, AWS automatically collects and sends metrics to CloudWatch. For custom metrics, you must write code that calls the PutMetricData API or configure the CloudWatch agent to collect system metrics like memory or disk space.

3

Publish to CloudWatch

The data point is sent to CloudWatch along with a timestamp, the metric name, the namespace, any dimensions (like InstanceId), and the value. CloudWatch stores this as a data point in the appropriate metric stream. The default storage is 1-minute resolution for standard metrics.

4

Retrieve and Visualize

You can use the CloudWatch console, CLI (get-metric-statistics), or SDK to query metric data. The data is returned as a list of timestamps and values. You can plot these on a graph in the console, often combining multiple metrics from different namespaces to see correlations.

5

Create an Alarm

Based on the metric data you have viewed, you can create a CloudWatch alarm. You specify the metric, the statistic (Average, Sum, etc.), the comparison operator (greater than, less than), the threshold value, and the evaluation periods. If the metric crosses the threshold for the specified number of periods, the alarm changes state to ALARM.

6

Configure Alarm Actions

Define what happens when the alarm enters the ALARM or OK state. Common actions include sending a notification to an SNS topic (email, SMS, etc.), executing an Auto Scaling policy to add or remove instances, or triggering an Lambda function for custom logic.

7

Monitor and Iterate

After the alarm and metric are set up, you should periodically review the dashboards and make adjustments. You might find that the threshold was set too low, causing false alarms, or too high, missing issues. Tuning the metrics and alarms is an ongoing process in a healthy cloud environment.

Practical Mini-Lesson

When working as a developer or DevOps engineer on AWS, you will interact with CloudWatch metrics on a daily basis during incidents and capacity planning. The most important practical skill is knowing how to publish a custom metric. AWS does not automatically give you memory or disk usage for EC2, so you must push these yourself.

The recommended way is to install the Amazon CloudWatch Agent on your EC2 instance. This agent can be configured via a JSON file to collect memory, swap, disk, and custom metrics like process counts. It then automatically sends these to CloudWatch under the CWAgent namespace.

Alternatively, you can write a simple Python script that uses the boto3 library to call put_metric_data. For example: client = boto3.client('cloudwatch'); client.put_metric_data(Namespace='MyApp', MetricData=[{'MetricName': 'ActiveUsers', 'Value': current_users, 'Unit': 'Count', 'Timestamp': datetime.

utcnow()}]). This is a common pattern in microservices where you need to track business-level KPIs. Another practical skill is retrieving metrics programmatically to build custom dashboards in other tools like Grafana.

The get_metric_data API call allows you to fetch multiple metrics in one request, which is more efficient and cost-effective than old get_metric_statistics. You specify the time range, the metric, the stat (e.g.

, Average), and the period. For example, to see CPU for the last hour with 5-minute granularity: response = client.get_metric_data(MetricDataQueries=[{'Id':'m1','MetricStat':{'Metric':{'Namespace':'AWS/EC2','MetricName':'CPUUtilization','Dimensions':[{'Name':'InstanceId','Value':'i-abc'}]},'Period':300,'Stat':'Average'}}], StartTime=datetime.

now()-timedelta(hours=1), EndTime=datetime.now()). This returns a structured response that you can parse. A common pitfall in production is that metrics with high resolution (1-second) can quickly increase costs.

For most use cases, standard 1-minute resolution is sufficient. If you need real-time alerting for a mission-critical component, you can enable high resolution but be mindful of the cost. Also, when using Auto Scaling, you must remember that the metric must be published with a timestamp close to the current time, or CloudWatch may reject it.

The agent automatically handles this. Finally, troubleshooting often starts with metrics. When a service degrades, you look at the metrics for each layer of your stack: client-side latency, ALB metrics (RequestCount, TargetResponseTime, 5xx count), EC2 metrics (CPU, Network), and RDS metrics (CPU, Connections, ReadLatency).

A sudden increase in Connection count combined with high CPU on RDS often points to a database bottleneck caused by inefficient queries or a missing index. In contrast, a spike in ALB latency with low EC2 CPU could indicate a network issue or a timeout waiting for an external service. The ability to read these metric patterns is what separates a good engineer from a great one.

Always start with the simplest metrics, like CPU and latency, and then drill into more specific custom metrics as needed.

Memory Tip

Think “Numbers with Names”: every CloudWatch metric is defined by its Namespace, Name, and optional Dimensions. Remember the three N’s: Namespace, Name, dimension.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Related Glossary Terms

Frequently Asked Questions

Can I see memory usage of my EC2 instance in CloudWatch without installing anything?

No. AWS does not automatically send memory usage for EC2. You must install the CloudWatch agent or use a custom script to push the memory metric to CloudWatch.

What is the default resolution for a CloudWatch metric?

Standard metrics have a resolution of 1 minute (60 seconds). You can enable detailed monitoring for 1-second resolution, but this incurs higher costs.

How long are CloudWatch metric data points stored?

Data points with a period of less than 60 seconds are stored for 3 hours. 1-minute data is stored for 15 days, 5-minute data for 63 days, and 1-hour data for 15 months.

What is a dimension in CloudWatch metrics?

A dimension is a key-value pair that refines a metric. For example, you can filter CPUUtilization by a specific InstanceId or by an AutoScalingGroupName.

Can I create an alarm on a custom metric before I publish any data?

You cannot create an alarm on a metric that does not exist. You must first publish at least one data point to create the metric, then create the alarm.

What statistic should I use for a metric that counts events over time?

Use the Sum statistic. Sum adds up all values in the period, which is ideal for counts of requests, errors, or logins. Average would distort the total.

What is the difference between a CloudWatch metric and a CloudWatch log?

A metric is a numerical value (like 75% CPU). A log is a text record (like an error message). Metrics are for trend analysis and alerts; logs are for detailed debugging.

Summary

CloudWatch metrics are the heartbeat of observability in the AWS cloud. They are numerical data points that track the health, performance, and operational state of your AWS resources and applications. Whether you are looking at built-in metrics like CPU utilization or custom metrics that track your own business KPIs, CloudWatch metrics allow you to establish baselines, set intelligent alarms, and automate actions that keep your systems running smoothly.

For developers studying for the AWS Developer Associate exam, mastery of CloudWatch metrics is non-negotiable. You will face questions that test your understanding of how to publish custom metrics, how to retrieve them using the CLI or SDK, and how to configure alarms with appropriate evaluation periods and statistics. The exam also requires you to differentiate between CloudWatch metrics, CloudWatch Logs, and CloudWatch alarms, as well as to be aware of the default retention periods and the need for the CloudWatch agent for memory and disk metrics.

In real IT practice, CloudWatch metrics are the first thing you check when something goes wrong. They allow you to quickly pinpoint the failing component, whether it is a saturated database, a CPU-bound web server, or a network bottleneck. By integrating metrics with Auto Scaling and SNS notifications, you can build self-healing architectures that scale automatically and alert you before users even notice a problem.

The key takeaway for exam and real life is this: think of CloudWatch metrics as your system’s vital signs. Without them, you are flying blind. With them, you have the power to monitor, alert, and automate your way to a stable and cost-efficient cloud environment.