- Newest
- Most votes
- Most comments
You're correct in your understanding that you've added two custom metrics (disk_used_percent and mem_used_percent) to each of your two EC2 instances. However, the reason you're seeing more metrics than expected is due to how the disk_used_percent metric works.
The disk_used_percent metric is collected for each mount point or filesystem on your EC2 instance. This means that if your EC2 instance has multiple partitions or attached volumes, you'll get a separate metric for each of these. This is why you're seeing multiple entries for disk_used_percent in your CloudWatch metrics.
To stay within the free tier (which allows up to 10 custom metrics), you have a few options:
-
Limit disk monitoring to specific mount points: In your CloudWatch agent configuration, you can specify which mount points to monitor. For example, you could monitor only the root partition ("/") by adding a "resources" section to your disk measurement configuration:
"disk": { "resources": ["/"], "measurement": ["disk_used_percent"], "metrics_collection_interval": 60 } -
Use a single aggregated disk metric: Instead of monitoring each partition separately, you could use a single metric that represents the overall disk usage of the instance. This would require some custom scripting or using a different metric collection method.
-
Reduce the number of instances or metrics you're monitoring: If you need to monitor all partitions, you might need to be selective about which instances or metrics you monitor to stay within the free tier.
Remember that CloudWatch billing is prorated hourly, so you won't immediately see the full impact of your metrics in the billing dashboard. It may take up to 24 hours for the usage to be fully reflected.
Also, note that while the first 10 custom metrics are free, there may still be charges for API calls to publish these metrics. The CloudWatch agent typically makes one PutMetricData API call per minute for each EC2 instance, which can result in charges if you exceed the free tier limits for API calls.
Sources
CloudWatch solution: Amazon EC2 health - Amazon CloudWatch
¿How does the billing of Cloudwatch Custom Metrics work? | AWS re:Post
Amazon CloudWatch Pricing – Amazon Web Services (AWS)
Relevant content
- asked 10 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 8 months ago
