How to Install Elasticsearch on Google Cloud

How to Install Elasticsearch on Google Cloud

Together, Google Cloud and Elastic share a vision of meeting customers where they are on their journey to the cloud. Our partnership has been inspired by our joint customers who are looking for choice, security, a platform for innovation and integrations that helps them get better insights from their data.

– Thomas Kurian, CEO, Google Cloud

This post is all about how to install Elasticsearch on Google Cloud.

Elasticsearch (ES) is an open-source, broadly-distributable, readily-scalable, analytics, enterprise-grade search engine including textual, numerical, geospatial, structured, and unstructured.

Elasticsearch can power extremely fast searches that support your data discovery applications and accessible through an extensive and elaborate API.

In addition to its speed, scalability, and resiliency, Elasticsearch has several powerful built-in features that make storing and searching data even more efficient.

Wherever you are in your cloud journey, Google Cloud gives you the ability to turn data into actionable intelligence so you can make better-informed business decisions.

Steps to Install Elasticsearch on Google Cloud:

First of all, you need to set up your Google Cloud account.

  • Once you have created an account, you need to get familiarized with it.

    After login into your Google cloud, create a project in Dashboard
    .elastic 1
  • Search “VM” from the search box and click on “VM instances”.elastic 2
  • Create VM instances by clicking on the “Create” button.elastic 3
  • Create a new VM instance by giving the name, allow HTTP traffic and HTTPS traffic then click on the “Create” button.elastic 4
  • You can see the created VM instance with the given name and select the ‘SSH‘ from the ‘Connect‘ column of VM instances.elastic 6
  • Update the package index using below command and before continuing with the installation.
    elastic 7
  • Allow access to your repositories via HTTPS.
    elastic 9
  • Update the GPG key for the Elasticsearch repository.
    elastic 11
  • Add the repository to your system.
elastic 12

  • Install elasticsearch using below command.
elastic 13

  • Elasticsearch does not run until you start it after finishing the installation. When you reboot the machine, you need to rerun the Elasticsearch service as it does not start automatically.
  • If you want to reload the elasticsearch when the system restarts, use the below commands:
  • To have elasticsearch automatically, reload when the system restarts, use the following commands:
  • First, reload the system configuration:
elastic 16

Enable the elasticsearch service

To change the status of service, use the below command

Check the status of the service once you finish the above steps.


  • The default configuration does not allow your machine to be accessed by other hosts. To allow remote access, use a text editor of your choice and open the elasticsearch.yml file.

Give permission:

elastic 18


    • Then press “Insert” key from your keyboard and pass your own port to ‘’.

elastic 19

Use UFW firewall to Secure Elasticsearch (Not Necessary).

The Uncomplicated Firewall (UFW) is built into Linux and disabled by default. Before enabling UFW, add the necessary rules.

Write the below command in the terminal,

elastic 20
You need to allow access on port 22 for remote access over SSH or the custom port if you changed the default SSH.

elastic 21
Elasticsearch listens to that port for incoming requests. Therefore, you have to allow access on port 9200 for your remote machine. 

sudo 92

  • The Elasticsearch service is active, the machine can be accessed remotely, and you already enabled UFW, if the tool works, you can use curl to test.
  • The default port for Elasticsearch is 9200. So, you can send an HTTP request on the localhost and see if you get a response.
    elastic 23

It may seem a bit lengthy but is simple to implement.

Do you have a question after the installation of elasticsearch?

Yes, I do… How can I use installed Elasticsearch on my Magento 2?

Visit here to configure Magento to use Elasticsearch.

Any doubts in the above solution? Please feel free to mention them in the Comments section below.

I’d be glad to help you out.

You can also refer to the video tutorial to Install Elasticsearch on Google Cloud from our Magento 2 video tutorial series:
How to Install Elasticsearch on Google Cloud 1

Also, do share the post with Magento Community via social media.

Thank you.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

(based on 13 Reviews)

Ronak is a Magento Developer at Meetanshi. He loves playing cricket. Apart from the work, he is an enthusiastic person who loves learning new skills.

Leave a reply:

Your email address will not be published.