Skip to content

Instantly share code, notes, and snippets.

@ekalvi
Last active August 29, 2015 14:16
Show Gist options
  • Save ekalvi/5dcf917163542ec35d30 to your computer and use it in GitHub Desktop.
Save ekalvi/5dcf917163542ec35d30 to your computer and use it in GitHub Desktop.
Add AWS CodeDeploy Agent to Ubuntu Instance
#!/bin/sh
KEY=$1
SECRET=$2
REGION=$3
if [ -z $KEY ]; then
echo "Error: Usage is init_codedeploy.sh <KEY> <SECRET> <REGION>"
exit 1
fi
if [ -z $SECRET ]; then
echo "Error: Usage is init_codedeploy.sh <KEY> <SECRET> <REGION>"
exit 1
fi
if [ -z $REGION ]; then
echo "Error: Usage is init_codedeploy.sh <KEY> <SECRET> <REGION>"
exit 1
fi
echo "Setting up AWS CodeDeploy Agent: key=${KEY} secret=${SECRET} region=${REGION}"
# system requirements
sudo apt-get update --assume-yes
# ruby is needed to isntall awscli
# awscli s needed for codedeploy
sudo apt-get install awscli ruby2.0 --assume-yes
# use credentials to install codedeploy agent locally
export AWS_ACCESS_KEY_ID=${KEY}
export AWS_SECRET_ACCESS_KEY=${SECRET}
export AWS_DEFAULT_REGION=${REGION}
aws s3 cp s3://aws-codedeploy-${REGION}/latest/install . --region ${REGION}
chmod +x ./install
sudo ./install auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment