Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RichardSilveira/376d863bb3e87fbf3b901eafb2a89898 to your computer and use it in GitHub Desktop.
Save RichardSilveira/376d863bb3e87fbf3b901eafb2a89898 to your computer and use it in GitHub Desktop.
#!/bin/bash -xe
## Code Deploy Agent Bootstrap Script##
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
function installdep(){
yum install -y ruby jq
}
function execute(){
wget https://aws-codedeploy-${REGION}.s3.amazonaws.com/latest/install
chmod +x ./install
if ./install auto; then
echo "Instalation completed"
exit 0
else
echo "Instalation script failed, please investigate"
rm -f /install
exit 1
fi
}
installdep
REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r ".region")
execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment