Course menuDOP-C02

Exams / DOP-C02 / Study guide / CloudWatch agent and metric streams

CloudWatch agent and metric streams: DOP-C02 study notes and practice questions

What to know about CloudWatch agent and metric streams for the DOP-C02 exam, from the Monitoring and Logging domain (15% of the exam guide), then 2 free questions to test it. Part of the DOP-C02 study guide.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

These questions ask how to get data EC2 doesn’t publish by default, or how to export metrics continuously to another tool.

The CloudWatch agent

  • EC2 publishes CPU, network and disk I/O, but not memory or disk space used. The CloudWatch agent collects these guest-level metrics.
  • Also collects log files, procstat (per-process metrics), StatsD and collectd custom metrics, Windows performance counters, and OpenTelemetry traces.
  • Works on EC2 and on-premises servers (with credentials).
  • Store the agent configuration in Parameter Store so every server reads the same settings; install and update with Systems Manager (Distributor, State Manager, Run Command).
  • The instance needs a role with CloudWatchAgentServerPolicy.
  • Container Insights and Application Signals use the agent on ECS and EKS.

Metric streams

  • Send selected metrics continuously (near real time) to Amazon Data Firehose, which delivers to S3, Redshift or partners (Datadog, Splunk, New Relic and others).
  • Include or exclude filters by namespace and metric name limit what leaves each account.
  • Output in JSON or OpenTelemetry format.
  • Cheaper and faster than polling GetMetricData from an external tool.

Cross-account views

CloudWatch cross-account observability lets a monitoring account see metrics, logs and traces from source accounts; metric streams are for exporting outside CloudWatch.

Common traps

  • Expecting memory metrics from EC2 without the agent.
  • Different hand-edited agent configs on each server.
  • Polling APIs from a third-party tool when a metric stream pushes data.
  • Streaming every namespace when only a few are needed.
  • Installing the agent by hand on each new server instead of through Systems Manager or the AMI.

Try the 2 practice questions

A game studio runs about 60 Linux dedicated game servers on Amazon EC2. The operations team wants memory and disk usage on each server in CloudWatch, at one-minute resolution.

The game engine is not instrumented for metrics, and the team does not want to change the game code to publish them. The team also wants the agent's settings to be kept in one place that every server reads, so that a change to the collected metrics reaches the whole fleet at once.

Which approach meets these requirements?

Choose one answer.

  1. A. Rely on the default EC2 metrics, which already include memory and disk usage for every instance at one-minute resolution, and create alarms on them.
  2. B. Add code to the game server that calls PutMetricData with memory and disk values every minute, give each host permission to publish, and deploy the change with the next game update.
  3. C. Install the CloudWatch agent on each server with a configuration that collects memory and disk metrics, and keep that configuration in one Parameter Store parameter that every server reads.
  4. D. Turn on VPC Flow Logs for the subnets where the game servers run, and create metric filters on the flow log records to count the bytes each server sends and receives.
Show the answer and explanation

Answer: C

Explanation

The CloudWatch agent collects guest-level memory and disk usage that EC2 does not publish by default, and its configuration can live in Parameter Store so every server reads the same settings. Default metrics, code changes and flow logs each miss the memory and disk values or change the game.

Study

A university runs research workloads in several AWS accounts and uses an external observability platform for dashboards and alerting. The platform accepts telemetry over an HTTPS endpoint in an OpenTelemetry-compatible format.

The university wants CloudWatch metrics from the EC2 and Lambda namespaces, and from its own custom namespace, streamed to the platform in near real time. Metrics from the test accounts are not needed, and the solution should not poll the CloudWatch API.

The team wants the stream to be managed by AWS, with the least custom code.

Which approach meets these requirements?

Choose one answer.

  1. A. Install the CloudWatch agent on every instance and configure it to forward all of its metrics to the platform's HTTPS endpoint directly, with a separate configuration for each account.
  2. B. Create a metric stream in each production account with include filters for the three namespaces, OpenTelemetry output, and Firehose delivery to the platform's HTTP endpoint.
  3. C. Write a Lambda function that calls GetMetricData every minute for each namespace in each account, converts the results to the platform's format and posts them to the HTTPS endpoint.
  4. D. Build a CloudWatch dashboard in each production account with the three namespaces, and share each dashboard with the platform team so that they can review the graphs.
Show the answer and explanation

Answer: B

  • A. Wrong: The agent covers only the metrics on its own host, so Lambda metrics and most AWS namespaces would be missing. Per-account configurations also add maintenance that the university wanted to avoid. Learn more: Collect metrics, logs, and traces using the CloudWatch agent (opens in a new tab)
  • B. Right: Correct. A metric stream sends the chosen namespaces continuously, and creating streams only in the production accounts leaves out the test accounts. Firehose delivers the OpenTelemetry records to the platform's HTTP endpoint with no polling code. Learn more: Use metric streams (opens in a new tab)
  • C. Wrong: This polls the CloudWatch API, which the university asked to avoid, and it has to handle pagination, retries and format conversion. The team would maintain all of that code. Learn more: GetMetricData (opens in a new tab)
  • D. Wrong: A shared dashboard shows graphs to people but sends no telemetry to the external platform, so its dashboards and alerts receive nothing. It does not stream the metrics anywhere.

Explanation

A CloudWatch metric stream sends selected namespaces continuously to a destination, and include filters limit which namespaces leave each production account. Delivery through Amazon Data Firehose to an HTTP endpoint needs no polling code. Host agents, polling Lambda functions and shared dashboards each miss the namespaces, the no-polling rule or the delivery to the platform.

Study

Want more on CloudWatch agent and metric streams? The 5 full-length practice sets have 9 more CloudWatch agent and metric streams questions, 375 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets

Study CloudWatch agent and metric streams

More Monitoring and Logging topics