Howto to install AWS CodeDeploy agent on EC2 instance

This script will install the latest version of AWS CodeDeploy agent on your EC2 instance running Ubuntu.

First, let’s create a bash script that will do this for us


Add this into your script:


sudo apt-get update

sudo apt-get install python-pip python-pip ruby2.0 wget -y

cd /home/ubuntu


chmod +x ./install

sudo ./install auto

sudo service codedeploy-agent status

rm install

Make the script executable:

chmod +x

Execute your script as root:

sudo ./

The only adjustment you may need to make is the S3 URL inside the script that has a region-specific endpoint. In my case, this is us-west-2 region:

Simply update us-west-2 to any other region where CodeDeploy is supported and you should be good to go.