forked from cloudtools/troposphere
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example of Elasticsearch Domain creation
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Converted from Elasticsearch Domain example located at: | ||
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#d0e51519 | ||
|
||
from troposphere import Template | ||
from troposphere.elasticsearch import ElasticsearchDomain, EBSOptions | ||
from troposphere.elasticsearch import ElasticsearchClusterConfig | ||
from troposphere.elasticsearch import SnapshotOptions | ||
|
||
|
||
templ = Template() | ||
|
||
templ.add_description('Elasticsearch Domain example') | ||
|
||
es_domain = templ.add_resource(ElasticsearchDomain( | ||
'ElasticsearchDomain', | ||
DomainName="ExampleElasticsearchDomain", | ||
ElasticsearchClusterConfig=ElasticsearchClusterConfig( | ||
DedicatedMasterEnabled=True, | ||
InstanceCount=2, | ||
ZoneAwarenessEnabled=True, | ||
InstanceType="m3.medium.elasticsearch", | ||
DedicatedMasterType="m3.medium.elasticsearch", | ||
DedicatedMasterCount=3 | ||
), | ||
EBSOptions=EBSOptions(EBSEnabled=True, | ||
Iops=0, | ||
VolumeSize=20, | ||
VolumeType="gp2"), | ||
SnapshotOptions=SnapshotOptions(AutomatedSnapshotStartHour=0), | ||
AccessPolicies={'Version': '2012-10-17', | ||
'Statement': [{ | ||
'Effect': 'Allow', | ||
'Principal': { | ||
'AWS': '*' | ||
}, | ||
'Action': 'es:*', | ||
'Resource': '*' | ||
}]}, | ||
AdvancedOptions={"rest.action.multi.allow_explicit_index": "true"} | ||
)) | ||
|
||
print(templ.to_json()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"Description": "Elasticsearch Domain example", | ||
"Resources": { | ||
"ElasticsearchDomain": { | ||
"Properties": { | ||
"AccessPolicies": { | ||
"Statement": [ | ||
{ | ||
"Action": "es:*", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"AWS": "*" | ||
}, | ||
"Resource": "*" | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"AdvancedOptions": { | ||
"rest.action.multi.allow_explicit_index": "true" | ||
}, | ||
"DomainName": "ExampleElasticsearchDomain", | ||
"EBSOptions": { | ||
"EBSEnabled": "true", | ||
"Iops": 0, | ||
"VolumeSize": 20, | ||
"VolumeType": "gp2" | ||
}, | ||
"ElasticsearchClusterConfig": { | ||
"DedicatedMasterCount": 3, | ||
"DedicatedMasterEnabled": "true", | ||
"DedicatedMasterType": "m3.medium.elasticsearch", | ||
"InstanceCount": 2, | ||
"InstanceType": "m3.medium.elasticsearch", | ||
"ZoneAwarenessEnabled": "true" | ||
}, | ||
"SnapshotOptions": { | ||
"AutomatedSnapshotStartHour": 0 | ||
} | ||
}, | ||
"Type": "AWS::Elasticsearch::Domain" | ||
} | ||
} | ||
} |