Created
June 16, 2016 13:24
-
-
Save bryantrobbins/0605e83227e74b0e1f37e314691af59d to your computer and use it in GitHub Desktop.
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
"BuildServer" : { | |
"Type" : "AWS::EC2::Instance", | |
"DependsOn" : "AttachGateway", | |
"Metadata" : { | |
"AWS::CloudFormation::Init" : { | |
"config" : { | |
"sources" : { | |
"/root" : "https://github.com/bryantrobbins/standard-aws/tarball/master" | |
}, | |
"files" : { | |
"/root/init/datadir/custom.yaml" : { | |
"content" : { "Ref": "Hieradata"}, | |
"encoding": "base64", | |
"mode" : "000644", | |
"owner" : "root", | |
"group" : "root" | |
} | |
}, | |
"commands" : { | |
"init-script" : { | |
"command" : "bash -x init.sh build &> /var/log/init.log", | |
"cwd" : "/root/init" | |
} | |
} | |
} | |
} | |
}, | |
"Properties" : { | |
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, | |
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "BuildInstanceType" }, "Arch" ] } ] }, | |
"InstanceType" : { "Ref" : "BuildInstanceType" }, | |
"KeyName" : { "Ref" : "KeyName" }, | |
"IamInstanceProfile": { | |
"Ref": "DeployInstanceProfile" | |
}, | |
"NetworkInterfaces" : [{ | |
"GroupSet" : [{ "Ref" : "SecurityGroupInternetSSH" }, { "Ref" : "SecurityGroupWebService" }, { "Ref": "ConsulServerSecurityGroup" }, { "Ref": "ConsulAgentSecurityGroup" }, { "Ref": "CommonSecurityGroup" }], | |
"AssociatePublicIpAddress" : "true", | |
"DeviceIndex" : "0", | |
"DeleteOnTermination" : "true", | |
"SubnetId" : { "Ref" : "Subnet" } | |
}], | |
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [ | |
"#!/bin/bash -xe\n", | |
"yum update -y aws-cfn-bootstrap\n", | |
"/opt/aws/bin/cfn-init ", | |
" --stack ", { "Ref" : "AWS::StackName" }, | |
" --resource BuildServer ", | |
" --region ", { "Ref" : "AWS::Region" }, "\n" | |
]]}} | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment