How to configure and start the AWS CloudWatch Agent?

First install the CloudWatch agent if you haven’t already here

1. Open the setup wizard

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard

 

2. Enter these values asked during setup

  1. On which OS are you planning to use the agent? : Enter
  2. Are you using EC2 or On-Premises? : Enter 1
  3. Which user are you planning to run the agent? : Enter 1
  4. Do you want to turn on the StatsD daemon?: Enter 2
  5. Do you want to monitor metrics from CollectD? : Enter 2
  6. Do you want to monitor any host metrics? Enter 1
  7. Do you want to monitor CPU metrics per core? Enter 1
  8. Do you want to add ec2 dimensions into all of your metrics if the info is available? : Enter 1
  9. Would you like to collect your metrics at high resolution? : Enter 1
  10. Which default metrics config do you want?: Enter 2
  11. Are you satisfied with the above config? Enter 1
  12. Do you have any existing CloudWatch log Agent configuration file to import for migration? : Enter 2
  13. Do you want to monitor any log files? : Enter 2
  14. Do you want to store the config in the SSM parameter store? : Enter 2

Note: if you make any mistakes in the above configuration, you can run the configuration setup again whenever you
want. The configurations that you make is saved in a JSON File.

 

3. Start the Agent

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s

 

4. Check Agent Status

systemctl status amazon-cloudwatch-agent