Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy AWS elasticsearch using serverless.yml

I need to use AWS elasticsearch service but also want to automate it. We have serverless configuration. How can we create an AWS elasticsearch service using serverless.yml?

like image 478
deosha Avatar asked Jun 19 '17 09:06

deosha


People also ask

Is AWS Elastic Search serverless?

Yes, there are some Elasticsearch-related Serverless plugin.

How do I implement Elasticsearch in AWS?

Access the Amazon Console and log in. In the Analytics section, select Elasticsearch Service. Click Create new domain, and under Deployment Type, select one of these options: Production—achieves AWS high availability by deploying across multiple availability zones (AZ) with dedicated master nodes.

What is the use of serverless Yml?

The service is simply the name of your project. Since Serverless lets us deploy a project in multiple stages (prod, dev, staging…), CloudFormation stacks will contain both the service name and the stage: app-prod , app-dev , etc.


1 Answers

You can add CloudFormation resources to the "resources" section. For ElasticSearch this would look something like this.

service: aws-nodejs
provider:
  name: aws
  runtime: nodejs6.10
functions:
  hello:
    handler: handler.hello
    environment:
      elasticURL:
        Fn::GetAtt: [ ElasticSearchInstance , DomainEndpoint ]

resources:
  Resources:
    ElasticSearchInstance:
      Type: AWS::Elasticsearch::Domain
      Properties:
        EBSOptions:
          EBSEnabled: true
          VolumeType: gp2
          VolumeSize: 10
        ElasticsearchClusterConfig:
          InstanceType: t2.small.elasticsearch
          InstanceCount: 1
          DedicatedMasterEnabled: false
          ZoneAwarenessEnabled: false
        ElasticsearchVersion: 5.3
like image 156
jens walter Avatar answered Sep 30 '22 03:09

jens walter