Last active
June 23, 2022 20:02
-
-
Save chhibber/6908927 to your computer and use it in GitHub Desktop.
LaunchConfig with Cloudformation::Init
This file contains 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
"LaunchConfig" : { | |
"Type" : "AWS::AutoScaling::LaunchConfiguration", | |
"Metadata" : { | |
"AWS::CloudFormation::Init" : { | |
"config" : { | |
"files" : { | |
"/tmp/boot-strap-nat00.sh" : { | |
"source" : { "Fn::Join" : ["", [ | |
"http://", { "Ref" : "AWS::Region" }, "-development-appname", ".s3.amazonaws.com/path/to/boot-strap-nat00.sh" | |
]]} | |
} | |
} | |
} | |
}, | |
"AWS::CloudFormation::Authentication": { | |
"rolebased" : { | |
"type": "s3", | |
"buckets": [ { "Fn::Join" : ["", [ { "Ref" : "AWS::Region" }, "-development-appname" ]]} ], | |
"roleName": { "Ref" : "IAMNATROLE" } | |
} | |
} | |
}, | |
"Properties" : { | |
"AssociatePublicIpAddress" : "True", | |
"KeyName" : { "Fn::Join" : [ "", [ { "Ref" : "AWS::Region" }, "-development" ] ] }, | |
"ImageId" : { "Fn::FindInMap" : [ "RegionMapNat", { "Ref" : "AWS::Region" }, "AMI"]}, | |
"IamInstanceProfile": { "Ref" : "IAMNATROLE" }, | |
"SecurityGroups" : [ { "Ref" : "SGnat" } ], | |
"InstanceType" : "m1.small", | |
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [ | |
"#!/bin/bash\n", | |
"set -e\n", | |
"set -x\n", | |
"yum -y update\n", | |
"sleep 3\n", | |
"yum -y update\n", | |
"easy_install --upgrade boto\n", | |
"# Download our bootstrap file\n", | |
"/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackId" }, " -r LaunchConfig ", | |
" --region ", { "Ref" : "AWS::Region" }, " || error_exit 'Failed to run cfn-init'\n", | |
"chmod u+x /tmp/boot-strap-nat00.sh\n", | |
"/tmp/boot-strap-nat00.sh\n" | |
]]}} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment