Developer Guides Getting Started Getting Started What is a Graph Database? Intro to Graph DBs Video Series Concepts: RDBMS to Graph Concepts: NoSQL to Graph Getting Started Resources Neo4j Graph Platform Graph Platform Overview Neo4j Desktop Intro Neo4j Browser Intro… Read more →

Developer Guides

Want to Speak? Get $ back.

Hosting Neo4j on Google Compute Engine

This guide explains how to deploy a single instance of Neo4j Enterprise on Google Cloud Platform.
You should know how to run and operate Neo4j locally. Knowledge of remote drivers to access Neo4j from your application helps you connect to your cloud-hosted database.

Before continuing with the guide make sure you’ve installed the GCloud Command Line Interface.

Let’s get started!

Create Firewall Rules

By default, Google won’t let traffic in and out of instances unless we allow it. So we begin by setting a simple firewall rule which will enable us to access the instance once it is launched:

gcloud compute firewall-rules create allow-neo4j-bolt-https \
   --allow tcp:7473,tcp:7687 \
   --source-ranges \
   --target-tags neo4j

This allows traffic into your node on port 7473 (HTTPS for Neo4j Browser) and 7687, which is the Bolt protocol for clients to work with the database. The source IP range provided allows the entire internet to contact your new instance, which you may narrow. The target tags specifies that this rule applies only to instances tagged neo4j. When we launch our instance, we’ll take care to apply that tag to it. In Google’s Cloud Console, here’s what your rule should look like:

firewall rule

We don’t have to open port 22 for SSH, that will already be done.

Create a Google Compute Instance from the Neo4j Public Image

Launching the instance is a single command:

gcloud config set project my-project-id
gcloud compute instances create my-neo4j-instance \
    --image neo4j-enterprise-1-3-4-9-apoc \
    --tags neo4j \
    --image-project launcher-public

The first line simply sets your project configuration to ensure you know where you are launching your instance. The second line launches an image found in a public project that we have provided. The image name neo4j-enterprise-1-3-4-9-apoc corresponds to an Ubuntu-based image that contains Neo4j 1:3.3.9, with the APOC plugin.

If you get an “image not found” error, this may mean you are attempting to launch a version that Neo4j has not published.

Note that the gcloud tool comes with many command line options that aren’t covered here. consult the documentation for a large number of options dealing with machine type, memory, available storage, and so on.

The --tags argument is important, because it allows us to configure the correct network permissions in the next step. By default, Google will block all external access to the network services unless you open them.

You’ll know that the launch succeeded when you see output like this:

Created [].
my-neo4j-instance  us-east1-b  n1-standard-1       RUNNING

Access Your New Instance

Navigate to https://[External_IP]:7473 and login with the user name neo4j and password neo4j. You will be prompted to change the password immediately.

Because you don’t have a hostname configured or a valid SSL certificate by default, your browser will warn you that the certificate isn’t trusted. This is expected, you can configure a certificate later if you choose.

How do I SSH into the instance?

You can run the following command to SSH into the instance:

gcloud compute ssh my-neo4j-instance

Inside of the VM, you can check the status of the neo4j service like this:

$ sudo systemctl status neo4j
● neo4j.service - Neo4j Graph Database
   Loaded: loaded (/etc/systemd/system/neo4j.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-03-14 11:19:56 UTC; 15min ago
 Main PID: 1290 (
    Tasks: 46
   Memory: 325.7M
      CPU: 20.690s
   CGroup: /system.slice/neo4j.service
           ├─1290 /bin/bash /etc/neo4j/
           └─1430 /usr/bin/java -cp /var/lib/neo4j/plugins:/etc/neo4j:/usr/share/neo4j/lib/*:/var/lib/neo4j/plugins/* -server -XX:+UseG1GC

How your new virtual machine works

Please consult Neo4j Cloud VMs for details on internals of Google VMs, including how to stop and start system services, configure Neo4j inside of the VM, and more.

Deleting the instance

Once we’ve finished using the instance we can run the following command to delete it:

gcloud compute instances delete my-neo4j-instance


You can ask questions and connect with other people launching Neo4j in the cloud at the cloud topic on the Community Site.