Ejemplo n.º 1
0
 def elasticsearch_cluster(self, name, ebs=True, voltype='gp2'):
     es_domain = self.template.add_resource(
         Domain(
             name,
             DomainName=name + 'domain',
             ElasticsearchClusterConfig=ElasticsearchClusterConfig(
                 DedicatedMasterEnabled=True,
                 InstanceCount=2,
                 ZoneAwarenessEnabled=True,
                 InstanceType=constants.ELASTICSEARCH_M3_MEDIUM,
                 DedicatedMasterType=constants.ELASTICSEARCH_M3_MEDIUM,
                 DedicatedMasterCount=3),
             EBSOptions=EBSOptions(EBSEnabled=ebs,
                                   Iops=0,
                                   VolumeSize=20,
                                   VolumeType=voltype),
             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"
             }))
     return es_domain
 def create_es_domain(self, ):
     t = self.template
     self.es_domain = t.add_resource(
         Domain(
             'ElasticsearchDomain',
             DomainName="jd-estest-domain-two",
             ElasticsearchClusterConfig=ElasticsearchClusterConfig(
                 DedicatedMasterEnabled=False,
                 InstanceCount=1,
                 ZoneAwarenessEnabled=False,
                 InstanceType=constants.ELASTICSEARCH_T2_SMALL),
             EBSOptions=EBSOptions(EBSEnabled=True,
                                   Iops=0,
                                   VolumeSize=10,
                                   VolumeType="gp2"),
             ElasticsearchVersion="6.2",
             SnapshotOptions=SnapshotOptions(AutomatedSnapshotStartHour=0),
             AccessPolicies={
                 'Version':
                 '2012-10-17',
                 'Statement': [{
                     'Effect': 'Allow',
                     'Principal': {
                         'AWS': '*'
                     },
                     'Action': 'es:*',
                     'Resource': '*'
                 }]
             }))
     t.add_output(
         Output("ElasticSearchDomainName",
                Value=Ref(self.es_domain),
                Description="Name of ES domain for cluster"))
Ejemplo n.º 3
0
es_domain = templ.add_resource(Domain(
    'ElasticsearchDomain',
    DomainName="ExampleElasticsearchDomain",
    ElasticsearchClusterConfig=ElasticsearchClusterConfig(
        DedicatedMasterEnabled=True,
        InstanceCount=2,
        ZoneAwarenessEnabled=True,
        InstanceType=constants.ELASTICSEARCH_M3_MEDIUM,
        DedicatedMasterType=constants.ELASTICSEARCH_M3_MEDIUM,
        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},
    VPCOptions=VPCOptions(
       SubnetIds=["subnet-4f2bb123"],
       SecurityGroupIds=["sg-04cf048c"]
    )
))