Login to you linux server
Check if codedeploy agent installed.
sudo codedeoploy-agent status
Remove any existing if already installed.
sudo yum erase codedeploy-agent
Remove any remaining logs at opt folder
cd /opt
sudo rm -r codedeploy-agent/
cd /etc/init.d
sudo rm -r codedeploy-agent
Install wget and codedeploy agent on instance using aws document. You can change the region as per your own region. You need to make sure the code deploy-agent is uninstalled completely if you are reinstalling.
sudo yum -y install wget
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install
sudo chmod +x ./install
sudo ./install auto
Without having to re-install you can also delete all logs at deployment-root folder and restart the codedeploy-agent again.
cd /opt/codedeploy-agent/deployment-root
sudo rm -r -f *
sudo service codedeploy-agent status
sudo service codedeploy-agent stop
sudo service codedeploy-agent start
To check codedeploy logs:
cd /opt/codedeploy-agent/deployment-root/deployment-logs
cat codedeploy-agent-deployments.log
To see log data in windows server
C:\ProgramData\Amazon\CodeDeploy\log\codedeploy-agent-log.txt