How do you know your cloud applications are healthy if you never look at them? That is the core problem Amazon CloudWatch solves. It is the eyes and ears of your AWS environment. For the SOA-C02 exam, you must understand how to set up monitoring so you can detect failures before customers do, and that is exactly what this chapter covers.
Jump to a section
Have you ever left for holiday and wondered if your house is actually okay?
That sinking feeling is exactly what Amazon CloudWatch solves for your cloud applications. Imagine you have a smart home with cameras at every door, a thermostat, and a water leak sensor. Without CloudWatch, it is like having all those gadgets but no central screen to see them. You would have to check each one manually, one by one, and you would never know if something went wrong until the neighbour calls about the flood.
CloudWatch is the central security hub. It collects all the video feeds (metrics) — the temperature, the motion detection, the water pressure. It lets you set rules: if the living room camera spots motion at 3 a.m., send a push alert (an alarm) to your phone. If the thermostat hits 35 degrees, turn on the air conditioner automatically (an automatic action). It also records a log of every event: who unlocked the door and when (log data).
Just like you do not watch your empty house all day, CloudWatch watches your cloud servers for you. It stores the footage (metrics) so you can rewind and see what happened last Tuesday when the site went down. Without it, you are flying blind — and in the cloud, that is how you lose money and fail your SysOps exam.
Amazon CloudWatch is a monitoring service for AWS resources and applications. Think of it as a dashboard that collects data about everything happening in your cloud: how much CPU your EC2 instance uses, how many requests your load balancer handles, and even custom business data like the number of shopping cart checkouts per minute.
The first core concept is a metric. A metric is a specific data point measured over time — for example, the CPU utilisation of a virtual server. Metrics are organised into namespaces, which are like folders that keep data from different services separate, like the EC2 namespace or the Lambda namespace. Each metric has a timestamp, a value, and optionally dimensions. Dimensions are key-value pairs that describe the metric, like InstanceId=i-1234567890abcdef0. They let you filter and drill down. For the exam, you need to know that CloudWatch stores metrics for 15 months, but the default retention is 15 months (you cannot change it, but you can get more frequent data with high-resolution metrics).
Next is the alarm. An alarm watches a single metric over a specified time period. You define a threshold (like CPU utilisation greater than 80%) and a period (like evaluate every 5 minutes). When the metric crosses the threshold for a certain number of consecutive evaluation periods (called datapoints to breach), the alarm changes state from OK to ALARM. Alarms can trigger actions: send a notification via Amazon Simple Notification Service (SNS), or automatically stop, terminate, reboot, or recover an EC2 instance. The exam loves to test the three states: OK, ALARM, and INSUFFICIENT_DATA — the last means there is not enough data to decide.
Then there is logs. CloudWatch Logs collects, monitors, and stores log files from EC2 instances, Lambda functions, and other sources. A log event is a single record of activity (like an error message or an access request). Log events are grouped into log streams, which are sequences of events from the same source (like one EC2 instance). Log streams are collected into log groups, which share the same retention, monitoring, and access control settings. You can set up metric filters to turn log data into CloudWatch metrics — for example, count every occurrence of the word ERROR in your application log and create a new custom metric. This is powerful for troubleshooting.
CloudWatch also includes dashboards. A dashboard is a customisable view in the CloudWatch console that displays metrics and alarms in widgets. You can create multiple dashboards for different teams or environments. They are great for operational visibility.
Finally, there is CloudWatch Events (now called Amazon EventBridge, but the exam may still use the old name). It allows you to respond to state changes in your AWS resources. For example, if an EC2 instance stops, you can trigger a Lambda function to start it back up. It is separate from alarms but often conflated.
Why does this exist? Before cloud, monitoring meant installing software on each server, setting up a central server to collect data, and praying the network did not fail. CloudWatch removes that management overhead. You do not install anything — it is built into AWS. It replaces expensive, self-managed monitoring stacks and gives you a single pane of glass for all your resources.
For the SOA-C02 exam, you must understand how to set up basic monitoring (enabled by default for some services), detailed monitoring (provides 1-minute metrics at extra cost), create alarms, and configure log collection via the CloudWatch agent or via AWS services directly. You also need to know how to use metric math to combine multiple metrics into a single alarm.
Enable basic monitoring on your resources
When you launch an EC2 instance or other AWS resources, basic monitoring is enabled by default. Metrics like CPU utilisation and network throughput are collected every 5 minutes and stored in CloudWatch. This is free and requires no configuration.
Enable detailed monitoring for EC2 instances (if needed)
If you need 1-minute data granularity for faster detection of issues, enable detailed monitoring in your EC2 launch settings or modify the instance. This incurs a cost per metric per hour. You must choose this if your alarm needs to react within minutes.
Install and configure the CloudWatch agent on your EC2 instances
To collect custom metrics (like memory usage) and application logs, install the CloudWatch agent. Configure the agent by editing a JSON file that specifies which log files to send and which metrics to collect. The agent runs on the instance and sends data to CloudWatch.
Create a log group and metric filter for your application logs
When the agent sends logs, they go to a log group (a logical container). Within the log group, configure a metric filter that scans each log event for a pattern (e.g., the word 'ERROR'). Every time the pattern matches, it increments a custom metric. This turns log events into numbers you can alarm on.
Create a CloudWatch alarm on your custom metric
Navigate to CloudWatch Alarms and create a new alarm. Select the custom metric you created from the log metric filter. Set a threshold (e.g., > 10 errors in 5 minutes). Set the evaluation period and number of datapoints to breach. Choose an action: send to an SNS topic that emails the team, or trigger an Auto Scaling policy.
Build a CloudWatch dashboard for operational visibility
Create a new dashboard in the CloudWatch console. Add widgets: line graphs of CPU utilisation, a number widget showing alarm status, and a text widget with runbook links. This gives your team a single page to monitor the health of the entire environment.
Use CloudWatch Logs Insights to troubleshoot an incident
When an alarm fires, open CloudWatch Logs Insights. Choose the relevant log group and write a query like 'fields @timestamp, @message | filter @message like /ERROR/ | sort @timestamp desc'. This displays relevant log lines in seconds, helping you find the root cause without manually scrolling.
An IT professional at a startup called 'QuickCart' — an online grocery delivery service — uses CloudWatch every day to keep the site running. Here is what that looks like.
QuickCart runs its application on a fleet of Amazon EC2 instances behind an Application Load Balancer. The ops team's number one worry is the site going down during peak hours, like Saturday at 11 a.m. when everyone orders lunch.
The first step is to create a dashboard. The senior sysadmin logs into the AWS Management Console, navigates to CloudWatch, and creates a new dashboard called 'QuickCart Production'. They add widgets: a line graph of CPU utilisation for all EC2 instances, a number widget showing the current request count per minute on the load balancer, and a text widget with the on-call phone number. This dashboard is pinned to a monitor in the office.
The second step is setting up alarms. The sysadmin creates an alarm on the metric 'CPUUtilization' for each instance. The threshold is 80% for 2 consecutive 5-minute periods. The action is to send a message to an SNS topic that triggers an email to the team and also pages the on-call engineer. They also create an alarm on the load balancer's 'HTTPCode_ELB_5XX_Count' metric — if error rates spike, the team knows immediately.
The third step involves logs. QuickCart's application runs on a custom web server that writes logs to disk. The sysadmin installs the CloudWatch agent on each EC2 instance. The agent is a piece of software that reads local log files and sends them to CloudWatch Logs. They configure it to monitor /var/log/app/error.log and send those log events to a log group called '/quickcart/app-errors'. They then create a metric filter on that log group that counts every line containing 'FATAL'. That count becomes a custom metric, and they create an alarm on it.
The fourth step is reaction. One Tuesday, the alarm fires. CPU utilisation on one instance hits 95%. The on-call engineer receives the SNS notification on their phone. They check the dashboard and see a spike. They then look at the log group and search for recent events using CloudWatch Logs Insights (a query tool). They discover a memory leak in a new deployment. They roll back the application and the alarm clears.
What tools does the professional use? They use the AWS Management Console for setup, the AWS CLI for scripting alarm creation, the CloudWatch agent for log collection, and CloudWatch Logs Insights for ad-hoc querying. - They set up automatic actions: one alarm triggers an Auto Scaling policy to add more instances. - They create a custom dashboard per environment (dev, test, prod). - They set up a billing alarm to alert if the monthly spend goes over budget. - They use composite alarms (which combine multiple other alarms) to reduce noise — only alert if CPU is high AND error rate is high.
Without CloudWatch, QuickCart would not know about problems until customers complain, which is too late. CloudWatch gives them proactive awareness. For the exam, you must be able to describe this exact workflow: install agent, send logs, create metric filter, alarm, action.
The SOA-C02 exam tests CloudWatch heavily, and it is one of the most important topics for the monitoring objective (4.1). Expect roughly 5-8 questions on CloudWatch concepts. Here is what they love to test.
First, the difference between basic and detailed monitoring. Basic monitoring provides 5-minute metrics for free. Detailed monitoring provides 1-minute metrics at an extra cost. The exam will ask: 'A customer needs to detect a performance degradation within 2 minutes. What should they enable?' The answer is detailed monitoring.
Second, alarm states. The three states are OK, ALARM, and INSUFFICIENT_DATA. A common trap: if an EC2 instance is stopped, its CPU metric will stop emitting data. The alarm will not go to ALARM immediately; it will go to INSUFFICIENT_DATA because there is no data at all. Do not confuse missing data with a breach.
Third, the CloudWatch agent versus the SSM agent. The CloudWatch agent is used to collect logs and custom metrics from EC2 on-premises servers. The SSM agent is for Systems Manager (run commands, patch). The exam will ask: 'Which tool collects logs?' Answer: CloudWatch agent.
Fourth, metric filters on logs. You must know that metric filters are used to turn log text into numeric metrics. The exam will give scenarios: 'You want to count the number of 404 errors in your application log. What should you use?' Metric filters and a custom metric. They might also test that you cannot create an alarm directly on a log group without first creating a metric filter.
Fifth, CloudWatch Logs Insights. This is a query engine for logs. It uses a query language. The exam tests that you use Insights for interactive searching, not for real-time alarms (alarms use metric filters).
Sixth, retention. The default retention for log events is never expire, but you can set it from 1 day to 10 years. The exam will ask: 'To comply with policy, logs must be stored for 3 years. What do you set?' Set retention policy to 3 years. Also know that you can export logs to Amazon S3 for archiving.
Seventh, cross-account monitoring. CloudWatch can aggregate logs and metrics from multiple accounts into a single monitoring account. This is called cross-account observability. For the exam, know that you need to set up a monitoring account and attach a resource policy to share logs.
Eighth, container monitoring. CloudWatch Container Insights monitors ECS and EKS clusters. It provides metrics like CPU and memory per container.
Common traps:
The exam will try to confuse CloudWatch Alarms with AWS Config rules. Alarms monitor performance; Config monitors configuration changes.
They will offer 'Create a Lambda function to check logs' as an answer, but the correct answer is 'Use a metric filter and alarm'.
They will offer 'Use EC2 detailed monitoring' when the question is about a RDS database. Detailed monitoring exists for RDS too, but the specific name is 'Enhanced Monitoring' for RDS — not the same. CloudWatch monitoring for RDS provides basic metrics, but Enhanced Monitoring provides OS-level metrics.
Memorise these key points:
Basic monitoring: 5 minutes
Detailed monitoring: 1 minute
Metric retention: 15 months (immutable)
Log retention: configurable 1 day to 10 years
Alarm actions: SNS, Auto Scaling, EC2 actions (stop, terminate, reboot, recover)
Composite alarms: combine multiple alarms to reduce noise
Logs Insights: query stored logs, not real-time
CloudWatch agent: collects logs and custom metrics from servers
Amazon CloudWatch collects and stores metrics for all AWS services for 15 months, and you cannot reduce this retention period.
Basic monitoring provides metrics every 5 minutes at no extra cost, while detailed monitoring provides 1-minute metrics for an additional charge.
An alarm has three states: OK, ALARM, and INSUFFICIENT_DATA; the last means there is not enough data to evaluate, not that something is wrong.
To monitor application logs from EC2, you must install the CloudWatch agent on the instance and configure it to send log events to a log group.
Metric filters in CloudWatch Logs convert log text into numeric metrics, enabling you to create alarms on log content, like counting error occurrences.
CloudWatch Logs Insights is a query tool for ad-hoc analysis of historical logs, not for real-time alerting.
You can create composite alarms that combine multiple alarms into a single alarm, reducing alert noise in your operations.
CloudWatch dashboards provide a customisable visual overview of your AWS environment, useful for operational awareness and troubleshooting.
These come up on the exam all the time. Here's how to tell them apart.
CloudWatch Basic Monitoring
Data collected every 5 minutes
No additional cost, included by default for EC2 and other services
Sufficient for general trend analysis and basic oversight
CloudWatch Detailed Monitoring
Data collected every 1 minute
Incurred cost per metric per hour
Required for rapid detection of performance degradation (within 2 minutes)
CloudWatch Alarms
Monitors performance metrics (CPU, errors, latency)
Triggers actions when metrics cross thresholds
States: OK, ALARM, INSUFFICIENT_DATA
AWS Config Rules
Monitors resource configuration (security groups, tags, encryption)
Evaluates compliance against desired rules
States: COMPLIANT, NON_COMPLIANT
CloudWatch Logs Metric Filter
Runs in real-time as log events arrive
Creates a new numeric metric that can be used in alarms
Good for alerting on specific log patterns
CloudWatch Logs Insights
Query tool for historical log analysis
Does not generate metrics; only retrieves log events
Good for debugging and post-incident analysis
CloudWatch Agent
Collects custom metrics (memory, disk) and logs from servers
Runs on EC2 and on-premises servers
Necessary for sending application logs to CloudWatch Logs
SSM Agent (Systems Manager)
Runs commands, patching, inventory, and session management
Installed by default on many AMIs
Does not collect logs or custom metrics natively
Standard Alarm
Monitors a single metric
Simpler to set up, fewer parameters
Can be noisy if the single metric fluctuates frequently
Composite Alarm
Monitors multiple other alarms and their logical combination (AND/OR)
Reduces noise by requiring multiple conditions to fire
Used to suppress false positives in complex environments
Mistake
CloudWatch only monitors EC2 instances.
Correct
CloudWatch monitors many AWS services, not just EC2. It can monitor RDS databases, Lambda functions, load balancers, S3 buckets, and many other services. It also supports custom metrics from your own applications.
Beginners often think monitoring is only about servers, but in the cloud, everything is monitored: databases, storage, networking, and serverless.
Mistake
If an alarm goes into INSUFFICIENT_DATA, it means something is wrong and I should alert my team.
Correct
INSUFFICIENT_DATA means there is not enough data to evaluate the alarm. This often happens when a resource is stopped or retired, not necessarily because of a performance issue. The alarm cannot breach because there is no data.
The word insufficient sounds bad, so beginners panic and treat it like an ALARM state, but it is just a neutral state indicating missing data points.
Mistake
You need to install the CloudWatch agent on EC2 instances to get basic metrics like CPU utilisation.
Correct
Basic metrics like CPU utilisation, disk reads, and network traffic are available by default for EC2 instances without installing any agent. The CloudWatch agent is only needed for custom metrics like memory usage or disk swap, and for collecting logs.
Because the agent is needed for advanced monitoring, beginners assume all metrics require it, but AWS provides a set of standard metrics for free.
Mistake
CloudWatch Logs Insights can alert you in real-time when a certain error appears.
Correct
CloudWatch Logs Insights is a query tool for searching and analysing historical log data. It is not designed for real-time alerting. For real-time alerts, you must create a metric filter (which generates a metric from log events) and then create an alarm on that metric.
People confuse the query capability (Logs Insights) with the monitoring capability (metric filters), because both involve logs.
Mistake
CloudWatch alarms can trigger any action, such as sending a message to Slack or calling an API.
Correct
CloudWatch alarms can only trigger actions that are AWS services: SNS (email, SMS, Lambda, SQS), Auto Scaling, and EC2 actions. To send to Slack or a custom API, you must route through an SNS topic to a Lambda function that does the custom work.
Beginners think alarms are general-purpose triggers, but they are tightly coupled to specific AWS action targets.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
CloudWatch monitors performance — metrics like CPU usage, error counts, and log data. CloudTrail records API activity — who did what, when, and from where. They are complementary: CloudTrail answers 'who deleted the bucket?', CloudWatch answers 'is the site slow?'
Yes. Basic EC2 metrics do not include memory usage. You must install and configure the CloudWatch agent to collect memory metrics (like used memory percentage) and send them as custom metrics to CloudWatch.
Yes. When creating an alarm on the CPUUtilization metric, you can set the action to 'Stop EC2 instance'. However, this is often bad practise because it stops a server that is busy with real traffic. Better to scale out with Auto Scaling.
CloudWatch retains all metrics for 15 months. You cannot reduce this period. For logs, you can set custom retention from 1 day to 10 years, or never expire (default). The retention policy for metrics is fixed by AWS.
A composite alarm is an alarm that monitors the state of other CloudWatch alarms. It reduces noise by only firing when multiple conditions (multiple alarms) are met simultaneously. For example, alarm to alert only if CPU is high AND error rate is high.
Yes. You can install the CloudWatch agent on on-premises servers (Linux or Windows). The agent sends metrics and logs to CloudWatch over the internet. This is common for hybrid cloud environments.
A log stream is a sequence of log events from a single source (like one EC2 instance or one Lambda invocation). A log group is a collection of log streams that share the same retention, monitoring, and access control settings. You organise related streams into groups.
You've just covered Monitoring with Amazon CloudWatch — now see how well it sticks with free SOA-C02 practice questions. Full explanations included, no account needed.
Done with this chapter?