This repository has been archived by the owner on Sep 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathopendelivery.template
133 lines (116 loc) · 3.68 KB
/
opendelivery.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Template to install the OpenDelivery Gem",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type" : "String"
},
"InstanceType" : {
"Description" : "Jenkins EC2 instance type",
"Type" : "String",
"Default" : "m1.medium",
"ConstraintDescription" : "must be a valid EC2 instance type."
}
},
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "AMI" : "ami-05355a6c" },
"us-west-1" : { "AMI" : "ami-951945d0" },
"us-west-2" : { "AMI" : "ami-16fd7026" },
"eu-west-1" : { "AMI" : "ami-24506250" },
"sa-east-1" : { "AMI" : "ami-3e3be423" },
"ap-southeast-1" : { "AMI" : "ami-74dda626" },
"ap-northeast-1" : { "AMI" : "ami-dcfa4edd" }
}
},
"Resources" : {
"User" : {
"Type" : "AWS::IAM::User",
"Properties" : {
"Path": "/",
"Policies": [{
"PolicyName": "root",
"PolicyDocument": { "Statement":[{
"Effect":"Allow",
"Action":"*",
"Resource":"*"
}
]}
}]
}
},
"HostKeys" : {
"Type" : "AWS::IAM::AccessKey",
"Properties" : {
"UserName" : { "Ref": "User" }
}
},
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"rubygems" : {
"opendelivery" : []
},
"yum" : {
"gcc-c++" : [],
"autoconf" : [],
"automake" : [],
"libxml2-devel" : [],
"libxslt-devel" : []
}
}
}
}
},
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"SecurityGroups" : [ {"Ref" : "FrontendGroup"} ],
"InstanceType" : { "Ref" : "InstanceType" },
"Tags": [ { "Key": "Name", "Value": "CloudPatrol" } ],
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#!/bin/bash\n",
"yum update -y aws-cfn-bootstrap\n",
"# Remove Ruby 1.8.7\n",
"yum erase -y ruby rubygems\n",
"# Install Ruby 1.9.3\n",
"yum -y install ruby19-devel\n",
"# Move Ruby 1.9.3 to Default Ruby\n",
"ln -s /usr/bin/ruby1.9 /usr/bin/ruby\n",
"ln -s /usr/bin/gem1.9 /usr/bin/gem\n",
"/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackId" }, " -r Ec2Instance ",
" --access-key ", { "Ref" : "HostKeys" },
" --secret-key ", { "Fn::GetAtt" : [ "HostKeys", "SecretAccessKey" ]},
" --region ", { "Ref" : "AWS::Region" }, "\n",
"/opt/aws/bin/cfn-signal", " -e 0", " '", { "Ref" : "WaitHandle" }, "'\n"
]]}}
}
},
"FrontendGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Enable SSH",
"SecurityGroupIngress" : [
{"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : "0.0.0.0/0"}
]
}
},
"WaitHandle" : {
"Type" : "AWS::CloudFormation::WaitConditionHandle"
},
"WaitCondition" : {
"Type" : "AWS::CloudFormation::WaitCondition",
"DependsOn" : "Ec2Instance",
"Properties" : {
"Handle" : { "Ref" : "WaitHandle" },
"Timeout" : "1500"
}
}
},
"Outputs" : {
}
}