Reduce your CloudWatch Costs in On-premise Environments



 

One of the most important services that AWS Provide us is CloudWatch

This service allows you to monitor your resources and be alert to possible failures.

You can use CloudWatch to collect metrics (Like cpu usage, disk usage, memory, etc) directly from your Resources and send them to AWS so you can determine how the current performance and status of your resources are.

Among these resources, there may be devices and peripherals from which it’s not necessary to collect metrics.

For example: if you have an OnPremise server running Container Services, you may just need to collect metrics from Devices that belong to the Physical server and not from the Containers! Like Cpu usage of one Docker container, or Disk usage.

But why am I telling you this? Because Once CloudWatch is installed, it starts collecting metrics from All the resources by default and this may result expensive.

A solution for this is to modify the Agent Configuration file.

So here is a tip for you:

if you are running CloudWatch in a Linux Server, file configuration is located in the following path: /opt/aws/amazon-cloudwatch/etc/amazon-cloudwatch-agent.d/

You can edit it with any editor program like vi, vim, or nano



Check this is an example:

As you can see, we have a “metrics” section.

In the “resources” attribute we have to indicate which resources we want to collect data from.

By default it has the “*” value, so which includes All your resources.



Let’s say you want to collect Disk Metrics only from your root partition ( / ), this is how the configuration file should be in that section:


And that’s it, as simple as that! In this way you can avoid possible expensive Cloudwatch Costs in your billing. Don’t forget to restart CloudWatch agent once you modify the file


For more information about how you can install Amazon CloudWatch please check this: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-commandline-fleet.html







Rodrigo González

DevOps Engineer

Teracloud







 

If you are interested in learning more about our #TeraTips or our blog's content, we invite you to see all the content entries that we have created for you and your needs.


Entradas recientes
Archivo
Buscar por tags
Síguenos
  • Twitter Basic Square