Configure AWS CLI in your machine using the following command:
sudo apt install awscli
Create access key and secret key of any user in your AWS account and provide it in your machine using below command:
aws configure
Now download and install cloudwatch agent on linux host:
- wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
- sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
Now, Create credentials file where ever you like as per below image:

Update the common-config.toml file for credentials file location using below command:
sudo vim /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml
Here, I created credentials file in /home/jeel directory :

Create config file and store in SSM Parameter store with the name “AmazonCloudWatch-linux”
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
Note: You can see that in AWS system manager in parameter store “AmazonCloudWatch-linux” is added
Now, Import the config, and start the agent
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m onPremise -c ssm:AmazonCloudWatch-linux -s
OUTPUT:
You can see the cloudwatch metrics in your AWS console
