# EC2 Detailed Monitoring Not Enabled

> Flags running production EC2 instances without 1-minute detailed monitoring; skips dev and test boxes.

Source: https://zop.dev/integrations/aws/recommendations/ec2-detailed-monitoring-not-enabled

---

## Five-minute metrics hide short spikes

The [EC2 detailed monitoring guide](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/manage-detailed-monitoring.html)
sets out the difference. Basic monitoring, the default, publishes status checks every minute and all
other metrics in 5-minute periods at no charge. Detailed monitoring publishes metrics in 1-minute
periods and is charged per metric. On a production instance, a CPU spike that lasts two minutes can
vanish inside a 5-minute average, and alarms or scaling policies keyed to those metrics react up to
five minutes late.

## Finding running instances on basic monitoring

```bash
aws ec2 describe-instances \
  --filters Name=instance-state-name,Values=running Name=monitoring-state,Values=disabled \
  --query 'Reservations[].Instances[].[InstanceId,InstanceType,Tags[?Key==`Name`]|[0].Value]' \
  --output table
```

## The gates before a finding

Three things must be true. The instance must be running. ZopNight must have read its monitoring
setting from AWS and seen that detailed monitoring is off; if the setting was not reported, nothing
fires. And the instance must not look like a development or test machine.

## How non-production instances are excluded

Because this rule asks you to spend money, ZopNight skips instances whose name or environment tag
(such as `env`, `environment`, `stage` or `tier`) marks them as dev or test. An explicit production
environment tag overrides that, so a box named `test-runner` but tagged `environment=prod` is still
evaluated.

## A cost increase, not a saving

This finding never adds to savings totals. Enabling detailed monitoring raises spend:
[CloudWatch pricing](https://aws.amazon.com/cloudwatch/pricing/) charges detailed monitoring metrics as
custom metrics, $0.30 per metric per month for the first 10,000, prorated by the hour. The pricing
page's own example assumes 7 metrics per instance, which works out to $2.10 a month; the real count
depends on instance type.

```text
monthly cost of enabling = metrics sent by the instance x $0.30
```

## Turning on detailed monitoring

1. Select the instance in the EC2 console.
2. Choose Actions, Monitor and troubleshoot, Manage detailed monitoring, and enable it. From the CLI:
   `aws ec2 monitor-instances --instance-ids i-0123456789abcdef0`.
3. Update alarms and scaling policies to use 60-second periods so they benefit from the finer data.
