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?
Yes, there are some Elasticsearch-related Serverless plugin.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With