Skip to main content

Custom Metrics Agent Installation – Linux Ubuntu

You are here:
← All topics

Learn how to install CWAgent custom metrics and improve AWS cloud monitoring.

There is no configuration required on CleanCloud, all steps must be done from your AWS panel.  

1.Go to the AWS System Manager Parameter Store page to create a parameter.

2.Click the Create parameter button

3.Set AmazonCloudWatch-linux to name, select Standard and choose String type. Paste the JSON content below. Finally, click Create Parameter.










































4.Once created, follow the next steps.

5.You must add two permissions to CWAgent: 

AmazonEC2RoleforSSM and CloudWatchAgentServerPolicy through AWS Managed polices in the IAM Role for EC2 instances. 

This IAM Role must be attached to EC2 instances. If you already have an IAM Role in use on the EC2 you only need to add the AmazonEC2RoleforSSM and CloudWatchAgentServerPolicy permissions. 

6.On the Create Role page select AWS Service and EC2 as Service. Click Next to continue. 

7.Select AmazonEC2RoleforSSM policy

8.Select CloudWatchAgentServerPolicy policy and click Next.

9.After this step there is the tags screen. There is no need to add tags. Click Next:Review.

10.On the preview page, add the role name and verify that the correct policies are applied then click Create Role. 

11.You must install the CWAgent in all instances in order to collect metrics. You can perform this process individually on each machine or automate this step by installing the bash script in the devops routine.

12.Follow the script below to perform such installation.



cd /home/ubuntu


sudo dpkg -i amazon-ssm-agent.deb

sudo rm -rf amazon-ssm-agent.deb


mkdir cwAgentPackage

cd cwAgentPackage


sudo apt-get install -y –force-yes unzip


sudo chmod +x

sudo ./

cd ..

sudo rm -rf cwAgentPackage


## JSON file stored via ParameterStore called AmazonCloudWatch-linux

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c ssm:AmazonCloudWatch-linux -s

sudo service amazon-ssm-agent restart




The agent now sends CloudWatch metrics that are collected by CleanCloud and will be available within 12 hours to use in dashboards and insights.


Got a question?

What is CloudWatch?

What is SSM? latest / userguide / ssm-agent. html

What is CWAgent? systems-manager / latest / userguide / sysman-manual-agent- install.html

Close Menu