-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudformation.yaml
91 lines (79 loc) · 2.25 KB
/
cloudformation.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
AWSTemplateFormatVersion: 2010-09-09
Parameters:
ElasticSearchCidrIp:
Type: String
IndexName:
Type: String
Default: distribution
LogBucket:
Type: String
ReportPrefix:
Type: String
Outputs:
KibanaUrl:
Value: !Sub "https://${Domain.DomainEndpoint}/_plugin/kibana/"
LambdaArn:
Value: !GetAtt LogParseStack.Outputs.LambdaArn
Resources:
Domain:
Type: AWS::Elasticsearch::Domain
UpdatePolicy:
EnableVersionUpgrade: true
Properties:
DomainName: !Ref AWS::StackName
ElasticsearchVersion: "7.10"
AccessPolicies: !Sub |-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"es:ESHttpGet",
"es:ESHttpPut",
"es:ESHttpPost",
"es:ESHttpDelete",
"es:ESHttpHead"
],
"Resource": "arn:aws:es:${AWS::Region}:${AWS::AccountId}:domain/${AWS::StackName}/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": "${ElasticSearchCidrIp}"
}
}
}
]
}
ElasticsearchClusterConfig:
DedicatedMasterEnabled: false
InstanceCount: 1
InstanceType: t3.small.elasticsearch
ZoneAwarenessEnabled: false
EBSOptions:
EBSEnabled: true
VolumeSize: 10
VolumeType: gp2
LogParseStack:
Type: AWS::CloudFormation::Stack
Properties:
Parameters:
Name: !Sub "${AWS::StackName}-log-parse"
DomainArn: !GetAtt Domain.DomainArn
DomainEndpoint: !GetAtt Domain.DomainEndpoint
IndexName: !Ref IndexName
LogBucket: !Ref LogBucket
TemplateURL: log-parse/cloudformation.yaml
EmsReportStack:
Type: AWS::CloudFormation::Stack
Properties:
Parameters:
Name: !Sub "${AWS::StackName}-ems-report"
DomainArn: !GetAtt Domain.DomainArn
DomainEndpoint: !GetAtt Domain.DomainEndpoint
IndexName: !Ref IndexName
OutputBucket: !Ref LogBucket
OutputPrefix: !Ref ReportPrefix
TemplateURL: ems-report/cloudformation.yaml