Bird
Raised Fist0
AWScloud~20 mins

CloudWatch metrics in AWS - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
CloudWatch Metrics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
Understanding CloudWatch Metric Retention Periods

CloudWatch stores metrics with different retention periods depending on the granularity. Which of the following correctly describes the retention period for 1-minute metrics?

A1-minute metrics are retained for 15 days.
B1-minute metrics are retained for 455 days.
C1-minute metrics are retained for 63 days.
D1-minute metrics are retained indefinitely.
Attempts:
2 left
💡 Hint

Think about how CloudWatch stores detailed metrics before aggregating them.

❓ Architecture
intermediate
2:00remaining
Choosing Metric Granularity for Cost and Detail

You want to monitor an application with detailed metrics but keep CloudWatch costs low. Which metric granularity should you choose to balance detail and cost?

AUse 1-second custom metrics for all data points.
BUse 1-minute standard metrics for most data points.
CUse 5-minute standard metrics for all data points.
DUse 1-hour aggregated metrics only.
Attempts:
2 left
💡 Hint

Consider the default granularity and cost implications.

❓ security
advanced
2:30remaining
Securing CloudWatch Metrics Access

You want to restrict access so that a user can only view CloudWatch metrics for a specific EC2 instance. Which IAM policy condition correctly enforces this?

AWS
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["cloudwatch:GetMetricData"],
    "Resource": "*",
    "Condition": {
      "StringEquals": {
        "cloudwatch:dimension_InstanceId": "i-1234567890abcdef0"
      }
    }
  }]
}
AUse a condition with "ec2:InstanceId" matching the EC2 instance ID.
BUse a resource ARN restricting to the EC2 instance ARN.
CUse a condition with "cloudwatch:Namespace" set to "AWS/EC2".
DUse a condition with "cloudwatch:dimension_InstanceId" matching the EC2 instance ID.
Attempts:
2 left
💡 Hint

CloudWatch metrics can be filtered by dimensions in IAM conditions.

❓ Configuration
advanced
2:30remaining
Configuring Custom Metrics with Dimensions

You want to publish a custom metric to CloudWatch with two dimensions: "ServiceName" and "Environment". Which of the following JSON payloads correctly represents this metric data?

A{ "MetricName": "RequestCount", "Dimensions": [{"Name": "ServiceName", "Value": "Auth"}, {"Name": "Environment", "Value": "Prod"}], "Value": 100 }
B{ "MetricName": "RequestCount", "Dimension": [{"Name": "ServiceName", "Value": "Auth"}, {"Name": "Environment", "Value": "Prod"}], "Value": 100 }
C{ "MetricName": "RequestCount", "Dimensions": {"ServiceName": "Auth", "Environment": "Prod"}, "Value": 100 }
D{ "MetricName": "RequestCount", "Dimensions": [{"ServiceName": "Auth"}, {"Environment": "Prod"}], "Value": 100 }
Attempts:
2 left
💡 Hint

Check the correct key names and structure for dimensions in CloudWatch metric data.

🧠 Conceptual
expert
3:00remaining
Interpreting CloudWatch Metric Math Output

You have two CloudWatch metrics: CPUUtilization and NetworkIn. You create a metric math expression: CPUUtilization / NetworkIn. If NetworkIn is zero at some points, what will be the output of the expression at those points?

AThe output will be null (no data) for those points.
BThe output will be infinity (∞) for those points.
CThe output will be zero to avoid division errors.
DThe output will cause the entire metric math query to fail.
Attempts:
2 left
💡 Hint

Think about how CloudWatch handles division by zero in metric math.

Practice

(1/5)
1. What is the primary purpose of AWS CloudWatch metrics?
easy
A. To create virtual machines
B. To store files and documents securely
C. To monitor and track the performance of cloud resources
D. To manage user permissions

Solution

  1. Step 1: Understand CloudWatch metrics role

    CloudWatch metrics collect data points about cloud resources like CPU usage or network traffic.
  2. Step 2: Identify the main use

    This data helps monitor and keep cloud resources healthy and efficient.
  3. Final Answer:

    To monitor and track the performance of cloud resources -> Option C
  4. Quick Check:

    CloudWatch metrics = Monitor resources [OK]
Hint: CloudWatch metrics = numbers about resource health [OK]
Common Mistakes:
  • Confusing metrics with storage services
  • Thinking metrics create resources
  • Mixing metrics with user management
2. Which of the following is the correct way to specify a metric namespace in AWS CloudWatch?
easy
A. Namespace: AWS/EC2
B. Namespace = AWS-EC2
C. Namespace -> AWS.EC2
D. Namespace is AWS_EC2

Solution

  1. Step 1: Recall CloudWatch namespace format

    Namespaces use a string format with a slash, like AWS/EC2, to group metrics.
  2. Step 2: Check each option format

    Only 'Namespace: AWS/EC2' uses the correct slash format without invalid characters.
  3. Final Answer:

    Namespace: AWS/EC2 -> Option A
  4. Quick Check:

    Namespace uses slash (/) format [OK]
Hint: Namespace uses slash (/) format, not dash or underscore [OK]
Common Mistakes:
  • Using dash or underscore instead of slash
  • Using equal sign instead of colon
  • Using arrow notation incorrectly
3. Given the following CloudWatch metric data points for CPU utilization: [10, 20, 30, 40, 50], what is the average CPU utilization reported?
medium
A. 10
B. 25
C. 50
D. 30

Solution

  1. Step 1: Sum all CPU utilization values

    10 + 20 + 30 + 40 + 50 = 150
  2. Step 2: Calculate average by dividing sum by count

    150 / 5 = 30
  3. Final Answer:

    30 -> Option D
  4. Quick Check:

    Average = Sum / Count = 30 [OK]
Hint: Average = add all values, divide by number of values [OK]
Common Mistakes:
  • Adding incorrectly
  • Dividing by wrong count
  • Picking max or min instead of average
4. You set a CloudWatch alarm to trigger when CPU utilization exceeds 70%, but it never triggers even when CPU is 80%. What is a likely cause?
medium
A. The metric period is too long, smoothing out spikes
B. The alarm threshold is set incorrectly below 70%
C. The alarm action is missing
D. The CPU utilization metric is disabled

Solution

  1. Step 1: Understand alarm threshold and metric period

    The alarm triggers if average CPU exceeds 70% during the period.
  2. Step 2: Identify effect of long metric period

    A long period averages out spikes, so short CPU spikes above 70% may not trigger alarm.
  3. Final Answer:

    The metric period is too long, smoothing out spikes -> Option A
  4. Quick Check:

    Long period averages hide spikes [OK]
Hint: Long metric periods smooth spikes, prevent alarms [OK]
Common Mistakes:
  • Assuming threshold is set below 70%
  • Ignoring missing alarm actions
  • Thinking metrics can be disabled
5. You want to monitor the average latency of your web application every 5 minutes using CloudWatch. Which combination of settings is best to achieve this?
hard
A. Set metric period to 60 seconds and statistic to Sum
B. Set metric period to 300 seconds and statistic to Average
C. Set metric period to 300 seconds and statistic to Maximum
D. Set metric period to 60 seconds and statistic to Minimum

Solution

  1. Step 1: Understand metric period and statistic

    Period defines how often data is collected; statistic defines how data is summarized.
  2. Step 2: Match requirements to settings

    To monitor average latency every 5 minutes, use 300 seconds period and Average statistic.
  3. Final Answer:

    Set metric period to 300 seconds and statistic to Average -> Option B
  4. Quick Check:

    5 min period + Average = correct monitoring [OK]
Hint: Use 300s period and Average for 5-minute average latency [OK]
Common Mistakes:
  • Using Sum or Maximum instead of Average
  • Using 60s period for 5-minute average
  • Confusing Minimum with latency monitoring
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard