Skip to content

Instantly share code, notes, and snippets.

@alofeoluwafemi
Forked from cgswong/aws-cfn.sh
Last active October 21, 2017 15:11
Show Gist options
  • Save alofeoluwafemi/f76fe6b6628b8bc89bec3cc02b56fe76 to your computer and use it in GitHub Desktop.
Save alofeoluwafemi/f76fe6b6628b8bc89bec3cc02b56fe76 to your computer and use it in GitHub Desktop.
Setup CentOS server with AWS CFN bootstrap
#!/bin/bash
# Setup CentOS 7 host as AMI
# Update base OS update, and install EPEL repo and Python Pip
sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm
sudo yum -y update
sudo yum install -y python34u python34u-libs python34u-devel
sudo yum -y install python-pip
# Install Python add-ons:
sudo pip install pystache
sudo pip install argparse
sudo pip install python-daemon
sudo pip install requests
# Install CFN-BootStrap from source
curl -O https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz && sudo tar -xvf aws-cfn-bootstrap-latest.tar.gz -C /opt
cd /opt/aws-cfn-bootstrap-1.4/
sudo python setup.py build
sudo python setup.py install
# Configure CFN
sudo ln -s /usr/init/redhat/cfn-hup /etc/init.d/cfn-hup
sudo chmod 775 /usr/init/redhat/cfn-hup
cd /opt
sudo mkdir aws
cd aws
sudo mkdir bin
sudo ln -s /usr/bin/cfn-hup /opt/aws/bin/cfn-hup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment