How to install and configure Elasticsearch on AWS

Elasticsearch is a distributed, open source search and analytics engine. In this post I will show you the easiest way to install Elasticsearch and get it running in your AWS server.

Step 1: installation

The first step is downloading the installation from the official website using the wget command (don’t forget sudo su – first):

[root@elasticsearch ~]wget

The second step is installing the package we downloaded using yum install:

[root@elasticsearch ~]yum install elasticsearch-1.4.1.noarch.rpm

Next simply enter the new elsaticsearch directory:

[root@elasticsearch ~]cd /usr/share/elasticsearch/

In this directory you’ll need to install a few simply plugins. One of the is the special pluging for AWS so in this case it’s the most important one. So simply copy the following commands:

[root@elasticsearch ~]./bin/plugin -install mobz/elasticsearch-head
[root@elasticsearch ~]./bin/plugin -install lukas-vlcek/bigdesk
[root@elasticsearch ~]./bin/plugin install elasticsearch/elasticsearch-cloud-aws/2.­4.1

These are the basic steps of the installation. now let’s configure our application.

Step 2: Configuration

First let’s go into the configuration directory and open the yml configuration file.

[root@elasticsearch ~]cd /etc/elasticsearch
[root@elasticsearch ~]vi elasticsearch.yml

This file may seem complicated but don’t worry, we are not going to change anything, only add some things of our own. One you get in the file simply on top of everything copy the next few lines and feel them with your own details: name_your_cluster ACCESS_KEY_HERE SECRET_KEY_HERE us-east-1
discovery.type: ec2
discovery.ec2.tag.Name: "Elasticsearch"
http.cors.enabled: true
http.cors.allow-origin: "*"  

*It is recommended that you create a new AWS user for the Elsaticsearch using the IAM console and give this user a high amount of permissions.

*If you don’t know what’s your access key you can go to the IAM console -> Users -> select your user and shift to the bottom of the page to view the access key.

*If you haven’t saved your secret key you can simply create a new one. you can read about this subject in the following page: aws Getting Your Access Key ID and Secret Access Key

Step 3: Finishing up

Now to apply the changes enter the command:

[root@elasticsearch ~]service elasticsearch restart


*Make sure that the following ports are open: 9200,9300,80
you can do that by editing the security group. for more information about that:aws Authorizing Inbound Traffic for Your Linux Instances

So after we checked:

1. The Elasticsearch user has administrative permissions

2. The ports 9200,9300,80 are open

3. The service is running (service elasticsearch status)

The elasticsearch server is up and running !

You can access it on your web browser with the PUBLIC IP of the server as follows:  (the meaning the public IP of your server)

you should see something like this:

  "ok" : true,
  "status" : 200,
  "name" : "Ultra-Marine",
  "version" : {
    "number" : "0.19.0",
    "snapshot_build" : false
  "tagline" : "You Know, for Search"


If you see this, it means your Elasticsearch server is working! This is the time to go ahead and apply this to every node you want in your Elasticsearch cluster.

It is my strong recommendation that you put your servers in a load balacer. For more about that: aws create load balancing


want a full ELK tutorial ? 

Continue with the Logstash installation: Install and configure logstash in aws


  1. Josh   •  

    Probably the best Elasticsearch tutorial I have read. Congratulations.
    Keep on the good work! I’ll be back for sure.

  2. Alexander   •  

    Thanks !! Amazing tutorial!!! I really appreciate this post. that helped me to reach my objectives

  3. Shenghan   •  

    org.elasticsearch.ElasticsearchException: Failed to load logging configuration

    ElasticsearchIllegalStateException[Failed to obtain node lock, is the following location writable?: [/usr/share/elasticsearch/data/elasticsearch]]

    Not work for me. I have this two type of exceptions. Don’t now if I did something wrong.

  4. sandeep   •  

    nice but we are unable to ping kibana please help .Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *