how do I uninstall the cloudwatch unified agent from an EC2 instance?

0

I installed the unified cloudwatch agent on an ec2 instance but now I no longer wish to collect metrics on this particular instance.

How do I uninstall the agent?

I can stop the agent but I would prefer to uninstall it completely (or disable it), because whenever I reboot the instance the agent starts again.

Thank you.

已提问 5 年前8128 查看次数
5 回答
2

Hello,

The procedure varies depending on the host and operating system you are using. The most common are Amazon Linux 2 and Windows.

On Amazon Linux 2 (AL2),

if you installed CloudWatch agent using the yum package manager:

sudo yum -v remove amazon-cloudwatch-agent

if you downloaded and installed CloudWatch agent using rpm package manager:

sudo rpm -v --erase amazon-cloudwatch-agent

On Windows Server, search for Add or Remove Programs, under Apps & Features find Amazon CloudWatch Agent, and click Uninstall.

Best,
Kevin

AWS
已回答 3 年前
1

I have the same problem.

The documentation (link below) states that "You can manually stop the CloudWatch agent using either AWS Systems Manager or the command line. When you stop it manually, you also prevent it from automatically starting at the system reboot."

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/troubleshooting-CloudWatch-Agent.html#CloudWatch-Agent-troubleshooting-stopping-restarting

However, after stopping it manually from the command line, contrary to what's said in the documentation, the CloudWatch agent starts up again after reboot.

So how does one make it stop permanently?

已回答 4 年前
0

To my knowledge the aws agent is installed as a systemd service on most Linux distros. In order not start it at boot time the service has to be disabled using systemctl. E.g. systemctl disable amazon-ssm-agent.service

sihaya
已回答 4 年前
0

Thank you. I think your answer gave me a good hint about why it's not working as per the documentation.

systemctl isn't available on Amazon Linux which we run, however the amazon-cloudwatch-agent-ctl script uses systemctl to do a lot of things, including disabling the service.

已回答 4 年前
0

Hello,

Use the following commands to uninstall AWS Systems Manager Agent (SSM Agent) in Ubuntu.

sudo dpkg -r amazon-ssm-agent
or
sudo snap remove amazon-ssm-agent

Reference: https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-uninstall-agent.html

Regards,
Muthu

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则