The following will guide you through the process of installing Elasticsearch on an AWS EC2 instance running Amazon Linux AMI 2016.09 - Release Notes
For this process I'll be using a t2.micro EC2 instance running Amazon Linux AMI. Once the EC2 instance is up-and-running, connect to your server via ssh.
sudo yum install java-1.8.0
sudo yum remove java-1.7.0-openjdk
$ sudo rpm -i https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.3.3/elasticsearch-2.3.3.rpm
Other versions of Elasticsearch are available here. Refer to the guide if you prefer installing with yum.
Register Elasticsearch as a system service.
$ sudo chkconfig --add elasticsearch
Start elasticsearch as a service
$ sudo service elasticsearch start
Once started, let's verify the Elasticsearch cluster by using curl to request the cluster state.
$ curl localhost:9200/_cluster/health?pretty
We should have something as below displayed in the terminal.
{
“cluster_name” : “esonaws”,
“status” : “green”,
“timed_out” : false,
“number_of_nodes” : 3,
“number_of_data_nodes” : 3,
“active_primary_shards” : 8,
“active_shards” : 16,
“relocating_shards” : 0,
“initializing_shards” : 0,
“unassigned_shards” : 0,
“delayed_unassigned_shards” : 0,
“number_of_pending_tasks” : 0,
“number_of_in_flight_fetch” : 0,
“task_max_waiting_in_queue_millis” : 0,
“active_shards_percent_as_number” : 100.0
}
You might want to play around the configuration for elasticsearch. To open the configuration file, run:
sudo nano /etc/elasticsearch/elasticsearch.yml
Your Elasticsearch cluster is ready!