User data to install and run ElasticSearch in Amazon Web Services (AWS) instance

by Marc Cortada 24/11/2015

This script installs ElasticSearch 1.7 in an AWS EC2 Ubuntu instance and also starts the service. So, Elastic Search is up and running when the machine is available.

Just add the following lines into the text box located at the section "Advanced Details > user data" when you are configuring a new EC2 instance. Remember that the selected AMI type in the previous steps must be an Ubuntu Server.

apt-get update
apt-get install unzip
apt-get install -y icedtea-7-plugin 
wget -qO - | sudo apt-key add -
echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list
apt-get update && sudo apt-get install elasticsearch
update-rc.d elasticsearch defaults 95 10
service elasticsearch start

If you want to enable the node to join an existing cluster, you should set the parameter to the appropriate name before to start the service. So, just comment or remove the last line of the previous script. Doing this the service won't start immediately and you will be able to set the appropriate value to the parameter editing the config file. Then you can start the service manually using the same instruction (sudo command may be needed). 


Categorías: Amazon Web Services (AWS) | AWS User Data | BigData | ElasticSearch

Entradas por mes