Skip to content

Instantly share code, notes, and snippets.

@bryantrobbins
Created June 16, 2016 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryantrobbins/0605e83227e74b0e1f37e314691af59d to your computer and use it in GitHub Desktop.
Save bryantrobbins/0605e83227e74b0e1f37e314691af59d to your computer and use it in GitHub Desktop.
"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