SOA-C02 Practice Question: CloudWatch custom metrics for application-level…
An EC2 instance runs a Java application. The operations team wants to monitor heap memory utilization in CloudWatch and set alarms when it exceeds 85 percent. EC2 does not natively publish memory metrics to CloudWatch. What is the simplest way to get this metric into CloudWatch?
⚠ Common exam trap
Watch out — candidates often assume detailed monitoring or Systems Manager Inventory can provide memory metrics, but neither feature collects or publishes memory utilization data to CloudWatch.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Install the CloudWatch agent on the instance and configure it to collect mem_used_percent; publish JVM heap metrics from the application using PutMetricData
The CloudWatch agent can collect custom metrics like memory utilization from the EC2 instance, and the Java application can directly publish JVM heap metrics to CloudWatch using the PutMetricData API. This combination provides the simplest and most direct way to monitor heap memory utilization and set alarms at the 85% threshold, as EC2 does not natively expose memory metrics.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Install the CloudWatch agent on the instance and configure it to collect mem_used_percent; publish JVM heap metrics from the application using PutMetricData
Why this is correct
The CloudWatch agent handles OS-level memory automatically once configured. For JVM heap, the application publishes a custom namespace metric via PutMetricData. Both appear in CloudWatch within minutes and can be graphed and alarmed like any native metric.
- ✗
Enable detailed monitoring on the EC2 instance to increase metric resolution to 1-minute intervals
Why it's wrong here
Detailed monitoring increases the frequency of pre-existing EC2 metrics (CPU, network, disk I/O) from 5 minutes to 1 minute. It does not add memory metrics — EC2 never publishes memory utilization regardless of monitoring detail level.
- ✗
Configure a CloudWatch Logs metric filter on the application log stream to count lines containing 'OutOfMemoryError'
Why it's wrong here
A metric filter counting OOM errors indicates memory exhaustion only after it occurs, not the percentage of heap used. This is a reactive indicator, not a proactive utilization metric suitable for setting a threshold alarm at 85 percent.
- ✗
Use AWS Systems Manager Inventory to collect memory data and sync it to CloudWatch
Why it's wrong here
AWS Systems Manager Inventory periodically gathers software and configuration metadata from instances, such as installed applications, OS versions, and network settings, for compliance and asset management. It writes this data to SSM Inventory tables, not to CloudWatch as a time-series metric, and it does not collect real-time memory utilization such as mem_used_percent. Therefore, this approach cannot feed an 85% heap or OS memory alarm with the required granularity and would not update CloudWatch continuously.
Go deeper
Related to this question
About these practice questions
Courseiva writes every SOA-C02 question from scratch — 247 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SOA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SOA-C02 exam.