Skip to content

Commit 01cecd6

Browse files
committed
Create opsworks-elasticsearch-11-10.template
1 parent 7c1a178 commit 01cecd6

File tree

1 file changed

+321
-0
lines changed

1 file changed

+321
-0
lines changed
Lines changed: 321 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,321 @@
1+
{
2+
"AWSTemplateFormatVersion": "2010-09-09",
3+
"Parameters": {
4+
"DefaultOWRoles": {
5+
"Description": "Yes = have OpsWorks use existing IAM roles from another OpsWorks stack, or No=create roles in the
6+
7+
CloudFormation stack.",
8+
"Type": "String",
9+
"Default": "Yes",
10+
"AllowedValues": [
11+
"Yes",
12+
"No"
13+
]
14+
},
15+
"WebUsername": {
16+
"Description": "WebUsername",
17+
"Type": "String",
18+
"Default": "username"
19+
},
20+
"WebPassword": {
21+
"Description": "WebPassword",
22+
"Type": "String",
23+
"Default": "password"
24+
},
25+
"CookbookRepo": {
26+
"Description": "GitURL",
27+
"Type": "String",
28+
"Default": "https://github.com/amazonwebservices/opsworks-elasticsearch-cookbook"
29+
}
30+
},
31+
"Conditions": {
32+
"DefaultOWRolesCondition": {
33+
"Fn::Equals": [
34+
{
35+
"Ref": "DefaultOWRoles"
36+
},
37+
"Yes"
38+
]
39+
},
40+
"NotDefaultOWRolesCondition": {
41+
"Fn::Equals": [
42+
{
43+
"Ref": "DefaultOWRoles"
44+
},
45+
"No"
46+
]
47+
}
48+
},
49+
"Resources": {
50+
"ServiceRole": {
51+
"Condition": "NotDefaultOWRolesCondition",
52+
"Type": "AWS::IAM::Role",
53+
"Properties": {
54+
"AssumeRolePolicyDocument": {
55+
"Statement": [
56+
{
57+
"Effect": "Allow",
58+
"Principal": {
59+
"Service": [
60+
"opsworks.amazonaws.com"
61+
]
62+
},
63+
"Action": [
64+
"sts:AssumeRole"
65+
]
66+
}
67+
]
68+
},
69+
"Path": "/",
70+
"Policies": [
71+
{
72+
"PolicyName": "opsworks-service",
73+
"PolicyDocument": {
74+
"Statement": [
75+
{
76+
"Effect": "Allow",
77+
"Action": [
78+
"ec2:*",
79+
"iam:PassRole",
80+
"cloudwatch:GetMetricStatistics",
81+
"elasticloadbalancing:*"
82+
],
83+
"Resource": "*"
84+
}
85+
]
86+
}
87+
}
88+
]
89+
}
90+
},
91+
"OpsWorksEC2Role": {
92+
"Condition": "NotDefaultOWRolesCondition",
93+
"Type": "AWS::IAM::Role",
94+
"Properties": {
95+
"AssumeRolePolicyDocument": {
96+
"Statement": [
97+
{
98+
"Effect": "Allow",
99+
"Principal": {
100+
"Service": [
101+
"ec2.amazonaws.com"
102+
]
103+
},
104+
"Action": [
105+
"sts:AssumeRole"
106+
]
107+
}
108+
]
109+
},
110+
"Path": "/",
111+
"Policies": [
112+
{
113+
"PolicyName": "opsworks-ec2-role",
114+
"PolicyDocument": {
115+
"Statement": [
116+
{
117+
"Effect": "Allow",
118+
"Action": [
119+
"ec2:DescribeInstances",
120+
"ec2:DescribeRegions",
121+
"ec2:DescribeSecurityGroups",
122+
"ec2:DescribeTags",
123+
"cloudwatch:PutMetricData"
124+
],
125+
"Resource": "*"
126+
}
127+
]
128+
}
129+
}
130+
]
131+
}
132+
},
133+
"InstanceRole": {
134+
"Condition": "NotDefaultOWRolesCondition",
135+
"Type": "AWS::IAM::InstanceProfile",
136+
"Properties": {
137+
"Path": "/",
138+
"Roles": [
139+
{
140+
"Ref": "OpsWorksEC2Role"
141+
}
142+
]
143+
}
144+
},
145+
"myStack": {
146+
"Type": "AWS::OpsWorks::Stack",
147+
"Properties": {
148+
"Name": {
149+
"Ref": "AWS::StackName"
150+
},
151+
"CustomJson": {
152+
"java": {
153+
"jdk_version": "7",
154+
"oracle": {
155+
"accept_oracle_download_terms": "true"
156+
},
157+
"accept_license_agreement": "true",
158+
"install_flavor": "oracle"
159+
},
160+
"elasticsearch": {
161+
"nginx": {
162+
"users": [
163+
{
164+
"username": {
165+
"Ref": "WebUsername"
166+
},
167+
"password": {
168+
"Ref": "WebPassword"
169+
}
170+
}
171+
],
172+
"allow_cluster_api": "true",
173+
"port": 80
174+
},
175+
"cluster": {
176+
"name": "opsworks-elasticsearch"
177+
},
178+
"gateway": {
179+
"expected_nodes": 3
180+
},
181+
"discovery": {
182+
"type": "ec2",
183+
"zen": {
184+
"minimum_master_nodes": 2,
185+
"ping": {
186+
"multicast": {
187+
"enabled": false
188+
}
189+
}
190+
},
191+
"ec2": {
192+
"tag": {
193+
"opsworks:stack": {
194+
"Ref": "AWS::StackName"
195+
}
196+
}
197+
}
198+
},
199+
"path": {
200+
"data": "/mnt/elasticsearch-data"
201+
},
202+
"cloud": {
203+
"aws": {
204+
"region": "us-east-1"
205+
}
206+
},
207+
"custom_config": {
208+
"cluster.routing.allocation.awareness.attributes": "rack_id"
209+
}
210+
}
211+
},
212+
"ServiceRoleArn": {
213+
"Fn::If": [
214+
"DefaultOWRolesCondition",
215+
{
216+
"Fn::Join": [
217+
"",
218+
[
219+
"arn:aws:iam::",
220+
{
221+
"Ref": "AWS::AccountId"
222+
},
223+
":role/aws-opsworks-service-role"
224+
]
225+
]
226+
},
227+
{
228+
"Fn::GetAtt": [
229+
"ServiceRole",
230+
"Arn"
231+
]
232+
}
233+
]
234+
},
235+
"DefaultInstanceProfileArn": {
236+
"Fn::If": [
237+
"DefaultOWRolesCondition",
238+
{
239+
"Fn::Join": [
240+
"",
241+
[
242+
"arn:aws:iam::",
243+
{
244+
"Ref": "AWS::AccountId"
245+
},
246+
":instance-profile/aws-opsworks-ec2-role"
247+
]
248+
]
249+
},
250+
{
251+
"Fn::GetAtt": [
252+
"InstanceRole",
253+
"Arn"
254+
]
255+
}
256+
]
257+
},
258+
"ConfigurationManager": {
259+
"Name" : "Chef",
260+
"Version" : "11.10"
261+
},
262+
"UseCustomCookbooks": "true",
263+
"CustomCookbooksSource": {
264+
"Type": "git",
265+
"Url": {
266+
"Ref": "S3Archive"
267+
}
268+
}
269+
}
270+
},
271+
"elasticsearchtest": {
272+
"Type": "AWS::EC2::SecurityGroup",
273+
"Properties": {
274+
"GroupDescription": "so that ES cluster can find other nodes"
275+
}
276+
},
277+
"searchLayer": {
278+
"Type": "AWS::OpsWorks::Layer",
279+
"Properties": {
280+
"StackId": {
281+
"Ref": "myStack"
282+
},
283+
"Name": "Search",
284+
"Type": "custom",
285+
"Shortname": "search",
286+
"CustomRecipes": {
287+
"Setup": [
288+
"apt",
289+
"ark",
290+
"elasticsearch",
291+
"elasticsearch::aws",
292+
"elasticsearch::proxy",
293+
"java",
294+
"layer-custom::esplugins",
295+
"layer-custom::allocation-awareness",
296+
"layer-custom::esmonit",
297+
"layer-custom::cloudwatch-custom"
298+
]
299+
},
300+
"EnableAutoHealing": "true",
301+
"AutoAssignElasticIps": "false",
302+
"AutoAssignPublicIps": "true",
303+
"VolumeConfigurations": [
304+
{
305+
"MountPoint": "/mnt/elasticsearch-data",
306+
"NumberOfDisks": 1,
307+
"Size": 100
308+
}
309+
],
310+
"CustomSecurityGroupIds": [
311+
{
312+
"Fn::GetAtt": [
313+
"elasticsearchtest",
314+
"GroupId"
315+
]
316+
}
317+
]
318+
}
319+
}
320+
}
321+
}

0 commit comments

Comments
 (0)