AWS CodeDeploy Agent Auto Installation Fails in Ubuntu
using EC2 Launch Configuration
I had tough time today installing AWS Code Deploy Agent in Ubuntu Server using EC2 launch configurations(user-data). As per this AWS blog it is just 2mins work.
My server runs Ubuntu 14.04 and I used following set of shell commands in as the launch configuration instructions.
#!/usr/bin/env bash
apt-get updateapt-get install -y ruby2.0
cd /home/ubuntu
wget https://aws-codedeploy-ap-southeast 2.s3.amazonaws.com/latest/install
chmod +x ./install
sudo /bin/bash ./install auto
Once sever is booted up, I executed sudo service codedeploy-agent status but did not find code deploy agent is running. As usual, I reached google for the help and found out this is an open issue in Code Deploy Agent. However, it is reported against Ubuntu 16.04 version. But, my experience proved it is there in 14.40 as well.
Fortunately, the reporter, chriskinsman has provided following work around fix to overcome this issue. chriskinsman, you saved my day !!! Thanks …
#!/usr/bin/env bash
apt-get update
apt-get install -y ruby2.0
cd /home/ubuntu
until service codedeploy-agent status >/dev/null 2>&1; do
sleep 60
rm -f install
wget https://aws-codedeploy-ap-southeast 2.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
service codedeploy-agent restart
done