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
nano install_code_deploy_agent.sh
Add this into your script:
#!/bin/bash sudo apt-get update sudo apt-get install python-pip python-pip ruby2.0 wget -y cd /home/ubuntu wget https://aws-codedeploy-us-west-2.s3.amazonaws.com/latest/install chmod +x ./install sudo ./install auto sudo service codedeploy-agent status rm install
Make the script executable:
chmod +x install_code_deploy_agent.sh
Execute your script as root:
sudo ./install_code_deploy_agent.sh
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:
https://aws-codedeploy-us-west-2.s3.amazonaws.com/latest/install
Simply update us-west-2 to any other region where CodeDeploy is supported and you should be good to go.
Marko