Skip to content

Instantly share code, notes, and snippets.

@Ginja
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Ginja/cad75934ec238d04b855 to your computer and use it in GitHub Desktop.
Save Ginja/cad75934ec238d04b855 to your computer and use it in GitHub Desktop.
Installs the latest CFN tools including the init.d script
#!/bin/bash
# Author: Riley Shott
# Description: Installs the latest CFN tools including the init.d script
if [[ -e "/etc/redhat-release" ]]; then
PKG_MGR="yum"
PLATFORM="redhat"
elif [[ -e "/etc/debian_version" ]]; then
PKG_MGR="apt-get"
PLATFORM="ubuntu"
else
echo "Could not determine OS platform, exiting"
exit 1
fi
mkdir -p /tmp/aws/aws-cfn-bootstrap-latest
cd /tmp/aws
curl -o 'aws-cfn-bootstrap-latest.tar.gz' 'https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz'
tar xvfz aws-cfn-bootstrap-latest.tar.gz --strip-components=1 -C aws-cfn-bootstrap-latest && rm -rf aws-cfn-bootstrap-latest.tar.gz
$PKG_MGR -y install python-setuptools
/usr/bin/easy_install pip
/usr/bin/pip install python-daemon
mkdir -p /opt/aws/bin
cd /tmp/aws/aws-cfn-bootstrap-latest
python setup.py build
python setup.py install --prefix /opt/aws
cp /tmp/aws/aws-cfn-bootstrap-latest/init/$PLATFORM/cfn-hup /etc/init.d/
chmod 755 /etc/init.d/cfn-hup
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment