Created
February 25, 2015 23:16
-
-
Save gibbster/3176b85b2e405de6d893 to your computer and use it in GitHub Desktop.
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
"WebServerInstance" : { | |
"Type" : "AWS::EC2::Instance", | |
"Metadata" : { | |
"Comment" : "Install a simple application", | |
"AWS::CloudFormation::Init" : { | |
"config" : { | |
"packages" : { | |
"yum" : { | |
"httpd" : [] | |
} | |
}, | |
"files" : { | |
"/var/www/html/index.html" : { | |
"content" : { "Fn::Join" : ["\n", [ | |
"<img src=\"", {"Fn::FindInMap" : ["Region2Examples", {"Ref" : "AWS::Region"}, "Examples"]}, "/cloudformation_graphic.png\" alt=\"AWS CloudFormation Logo\"/>", | |
"<h1>Congratulations, you have successfully launched the AWS CloudFormation sample.</h1>" | |
]]}, | |
"mode" : "000644", | |
"owner" : "root", | |
"group" : "root" | |
}, | |
"/etc/cfn/cfn-hup.conf" : { | |
"content" : { "Fn::Join" : ["", [ | |
"[main]\n", | |
"stack=", { "Ref" : "AWS::StackId" }, "\n", | |
"region=", { "Ref" : "AWS::Region" }, "\n" | |
]]}, | |
"mode" : "000400", | |
"owner" : "root", | |
"group" : "root" | |
}, | |
"/etc/cfn/hooks.d/cfn-auto-reloader.conf" : { | |
"content": { "Fn::Join" : ["", [ | |
"[cfn-auto-reloader-hook]\n", | |
"triggers=post.update\n", | |
"path=Resources.WebServerInstance.Metadata.AWS::CloudFormation::Init\n", | |
"action=/opt/aws/bin/cfn-init -v ", | |
" --stack ", { "Ref" : "AWS::StackName" }, | |
" --resource WebServerInstance ", | |
" --region ", { "Ref" : "AWS::Region" }, "\n", | |
"runas=root\n" | |
]]} | |
} | |
}, | |
"services" : { | |
"sysvinit" : { | |
"httpd" : { "enabled" : "true", "ensureRunning" : "true" }, | |
"cfn-hup" : { "enabled" : "true", "ensureRunning" : "true", | |
"files" : ["/etc/cfn/cfn-hup.conf", "/etc/cfn/hooks.d/cfn-auto-reloader.conf"]} | |
} | |
} | |
} | |
} | |
}, | |
"Properties" : { | |
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, | |
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, | |
"InstanceType" : { "Ref" : "InstanceType" }, | |
"KeyName" : { "Ref" : "KeyName" }, | |
"Tags" : [ {"Key" : "Application", "Value" : { "Ref" : "AWS::StackId"} } ], | |
"NetworkInterfaces" : [{ | |
"GroupSet" : [{ "Ref" : "InstanceSecurityGroup" }], | |
"AssociatePublicIpAddress" : "true", | |
"DeviceIndex" : "0", | |
"DeleteOnTermination" : "true", | |
"SubnetId" : { "Ref" : "Subnet" } | |
}], | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment