-
Notifications
You must be signed in to change notification settings - Fork 17
/
elasticsearch-template.yaml
92 lines (89 loc) · 2.63 KB
/
elasticsearch-template.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: ElasticSearchService
Parameters:
AlisAppId:
Type: String
Conditions:
IsProduction: !Equals [!Ref AlisAppId, "alis"]
Resources:
ElasticSearchService:
Type: "AWS::Elasticsearch::Domain"
Properties:
AccessPolicies:
"Fn::Sub":
- |-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "${ApiLambdaRole}"
},
"Action": "es:*",
"Resource": "arn:aws:es:${Region}:${AccountId}:domain/${StackName}/*"
},
{
"Effect": "Allow",
"Principal": {
"AWS": "${LaboLambdaRole}"
},
"Action": "es:*",
"Resource": "arn:aws:es:${Region}:${AccountId}:domain/${StackName}/*"
},
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": "arn:aws:es:${Region}:${AccountId}:domain/${StackName}/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": "192.168.0.1"
}
}
}
]
}
- {
ApiLambdaRole: {"Fn::ImportValue": !Sub "${AlisAppId}-LambdaRole"},
LaboLambdaRole: {"Fn::ImportValue": !Sub "${AlisAppId}-LaboLambdaRole"},
Region: !Ref 'AWS::Region',
AccountId: !Ref 'AWS::AccountId',
StackName: !Ref 'AWS::StackName'
}
AdvancedOptions:
rest.action.multi.allow_explicit_index: 'true'
DomainName: !Ref "AWS::StackName"
EBSOptions:
EBSEnabled: true
VolumeType: gp2
VolumeSize: !If [
IsProduction,
35,
10
]
ElasticsearchClusterConfig:
InstanceType: !If [
IsProduction,
m5.large.elasticsearch,
t2.small.elasticsearch
]
InstanceCount: !If [
IsProduction,
2,
1
]
DedicatedMasterEnabled: true
ZoneAwarenessEnabled: false
DedicatedMasterType: !If [
IsProduction,
m5.large.elasticsearch,
t2.small.elasticsearch
]
DedicatedMasterCount: 3
ElasticsearchVersion: '6.2'
SnapshotOptions:
AutomatedSnapshotStartHour: 0