Uninstall the CodeDeploy agent
You can remove the CodeDeploy agent from instances when it is no longer needed or when you want to perform a fresh installation.
Uninstall the CodeDeploy agent from Amazon Linux or RHEL
To uninstall the CodeDeploy agent, sign in to the instance and run the following command:
sudo yum erase codedeploy-agent
Uninstall the CodeDeploy agent from Ubuntu Server
To uninstall the CodeDeploy agent, sign in to the instance and run the following command:
sudo dpkg --purge codedeploy-agent
Uninstall the CodeDeploy agent from Windows Server
To uninstall the CodeDeploy agent, sign in to the instance and run the following three commands, one at a time:
wmic product where name="CodeDeploy Host Agent" call uninstall /nointeractive exit
Note
On Windows Server 2025 and later, wmic is deprecated. Use the following
PowerShell command instead:
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*' | Where-Object DisplayName -eq 'CodeDeploy Host Agent' | ForEach-Object { Start-Process msiexec.exe -ArgumentList "/x $($_.PSChildName) /quiet" -Wait }
You can also sign in to the instance, and in Control Panel, open Programs and Features, choose CodeDeploy Host Agent, and then choose Uninstall.
Uninstall the CodeDeploy agent from macOS
To uninstall the CodeDeploy agent, sign in to the instance and run the following command:
sudo /opt/codedeploy-agent/bin/uninstall.sh