Created
October 2, 2017 09:00
-
-
Save hugoprudente/ee2f5cc3b97fe955fad4e41097c41af8 to your computer and use it in GitHub Desktop.
CloudFormation Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
mkdir -p /tmp/aws-cfn-bootstrap-latest | |
curl https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz | tar xz -C /tmp/aws-cfn-bootstrap-latest --strip-components 1 | |
curl https://s3-ap-southeast-2.amazonaws.com/bucket/cfn-hup.service -o /etc/systemd/system/cfn-hup.service | |
apt update -y | |
apt install -y python-pip libssl-dev libffi-dev | |
pip install --upgrade pip | |
pip install pyopenssl ndg-httpsclient pyasn1 | |
pip install --upgrade /tmp/aws-cfn-bootstrap-latest | |
cp /tmp/aws-cfn-bootstrap-latest/init/ubuntu/cfn-hup /etc/init.d/cfn-hup | |
chmod +x /etc/init.d/cfn-hup | |
update-rc.d cfn-hup defaults | |
/usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource UbuntuVulcanDeveloper --configsets InstallAndRun --region ${AWS::Region} | |
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource UbuntuVulcanDeveloper --region ${AWS::Region} | |
### Configuration /etc/cfn/hooks.d/cfn-auto-reloader.conf | |
[cfn-auto-reloader-hook] | |
triggers=post.update | |
path=Resources.LaunchConfig.Metadata.AWS::CloudFormation::Init | |
action=/usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource UbuntuVulcanDeveloper --configsets InstallAndRun --region ${AWS::Region} | |
runas=root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment