Multi-AZ Elasticsearch Component
Creating a multi-az elasticsearch in cloudformation is complicated so we have a highlander component that makes it simple!
This latest feature is available in the the 0.2.0
release of the elasticsearch component.
Example
In the following example we’ll create a multi-az cluster with 3 data nodes spread across 3 az’s inside a vpc.
The first thing is this beautiful error Before you can proceed, you must enable a service-linked role to give Amazon ES permissions to access your VPC.
! We’ll have to create this first with the aws cli
aws iam create-service-linked-role --aws-service-name es.amazonaws.com
Now lets create our highlander project
kurgan project demo
open the demo.cfhighlander.rb
file and add
CfhighlanderTemplate do
Name 'demo'
Description "demo-multi-az-elasticsearch-cluster"
Component template: 'vpc-v2@0.5.3', name: 'vpc', config: {max_availability_zones: 3} do
parameter name: 'AvailabiltiyZones', value: 3
parameter name: 'CIDR', value: '10.0.0.0/16'
parameter name: 'SubnetBits', value: 8
parameter name: 'DnsDomain', value: 'demo.com'
end
Component name: 'elasticsearch', template: 'elasticsearch@0.2.0' do
parameter name: 'Subnets', value: cfout('vpc.ComputeSubnets')
parameter name: 'ESDomainName', value: 'demo'
parameter name: 'ElasticsearchVersion', value: 7.4
parameter name: 'AutomatedSnapshotStartHour', value: 0
parameter name: 'InstanceCount', value: 1
parameter name: 'InstanceType', value: 'm5.large.elasticsearch'
end
end
then next we’ll add our elasticsearch EBS volume configuration in the elasticsearch.config.yaml
file
ebs_options:
EBSEnabled: true
VolumeSize: 20
VolumeType: gp2
now we can compile and launch our elasticsearch cluster!
For more info on multi-az elasticsearch or more complex clusters with dedicated master nodes take a look at the aws docs