-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
51 lines (46 loc) · 1.48 KB
/
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
AWSTemplateFormatVersion: '2010-09-09'
Description: Elasticsearch Sample
Parameters:
NamePrefix:
Type: String
Default: aws-elasticsearch-sample
ESDomainName:
Description: 'Elasticsearch Domain Name'
Type: String
MinLength: 3
MaxLength: 28
AllowedPattern: '^[a-z0-9+-]*$'
Default: elasticsearch-sample-domain
Resources:
# 他のテンプレートでも作成しようとするとエラーになるので注意
EsServiceLinkedRole:
Type: 'AWS::IAM::ServiceLinkedRole'
Properties:
AWSServiceName: es.amazonaws.com
Description: 'Service Linked Role for Amazon Elasticsearch Service'
ElasticSearch:
Type: AWS::Elasticsearch::Domain
Properties:
AccessPolicies:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
AWS:
Fn::ImportValue: !Sub '${NamePrefix}-lambda-role-arn'
Action: 'es:*'
Resource: !Sub 'arn:aws:es:${AWS::Region}:${AWS::AccountId}:domain/${ESDomainName}/*'
DomainName: !Ref ESDomainName
EBSOptions:
EBSEnabled: true
VolumeSize: 10
VolumeType: gp2
ElasticsearchClusterConfig:
InstanceCount: 1
InstanceType: t2.small.elasticsearch # t2.micro.es は、ES1.5or2.3 のみサポート
ElasticsearchVersion: 7.1
Outputs:
ElasticSearchDomainArn:
Value: !GetAtt ElasticSearch.DomainArn
ElasticSearchDomainEndpoint:
Value: !GetAtt ElasticSearch.DomainEndpoint