cancel
Showing results for 
Search instead for 
Did you mean: 

Using Neo4j Browser to access Neo4j deployed on AWS EC2

manish_giri_me
Node Clone

If I deploy Neo4j on AWS EC2, Is it possible to use Neo4j Browser to access neo4j and run Cypher queries? I ask because my code to create nodes and relationships and query them is all in Cypher. I have been using my own laptop so far, but the next dataset is huge, and might require more RAM/storage, so I need to use EC2 for this.

If it is possible, would appreciate if anyone has any links/resources that help with deploying neo4j on ec2 and access it using Neo4J Browser.

Many Thanks.

8 REPLIES 8

benjamin_squire
Graph Voyager

Definitely possible. I run my Neo4j on EC2 all the time. Change the config file to be accessible to non-local, i.e. - 0.0.0.0 (you should see the line for it ). Change EC2 to have elastic IP and be publicly accessible. If you are behind a firewall make sure you can ssh into the EC2, should allow you to hit it from http://<my.elastic.ip.address>:7474/browser. you can either set up a neo4j service as seen by https://neo4j.com/docs/operations-manual/current/installation/linux/debian/ or just create a tmux session and run NEO4J_HOME/bin neo4j console.

You can also leave it local and if you can ssh into the instance then just run NEO4J_HOME/bin cypher-shell, although I normally change the default password via the browser. BTW, EBS-optimized instances suck for normal writing and reading, even on large machines with big IOPS. Best to use the instance storage SSD even though they are ephemeral and then back up the tar gz the graph.db and save to an EBS if you need to snapshot your data.

Hi Benjamin,

I encountered a similar situation and I came across your answer. I think your answer should be the solution but I got stuck somewhere. I'd really appreciate if you could share your perspectives.

Background:
I set up a Neo4j database on AWS EC2 following this tutorial:


I have access to the Neo4j browser version and I can use Cypher in the browser. But I'd like to run Cypher script using a file, instead of manually copy-paste commands into the browser.

What I tried:
By following your answer, I ssh to the instance, but I cannot find the "NEO4J_HOME" folder. All the files I can see is:
"licensing", "pre-neo4j.sh", "reset-password-aws.sh".

Am I doing something wrong here? Would you please share more insight?
Thanks in advance!

Depending on what distro you have it might be different.

My Home folder is /var/lib/neo4j.

cd /var/lib/neo4j should direct you to the Neo4j Home holder

To run cypher from a shell script/ cypher script, you need to find the bin folder in Neo4j_home and then you can pipe the script into cypher-shell as follows

cat myscript.cypher | bin/cypher-shell -u neo4j -p mypassword

Hi Benjamin,

Thanks for the timely response! I have a follow-up question: I couldn't even find the "/var" folder.

Here's what I did:

  1. Connect to the EC2 instance by:
    "ssh -i Neo4j-AWS-Key.pem ubuntu@ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com"

  2. Execute "ls" and here's what I got:
    2X_4_482919f0f7a9c0f2b77fd4c9341fdaf11fb2ec77.png

It looks like completely empty... Nothing there.
However, I can connect to the browser from "http://<my.elastic.ip.address>:7474/browser".

Am I doing something stupid here? Thanks!

According to the link you shared they have the following information: https://neo4j.com/developer/neo4j-cloud-vms/

It says it the conf file should be located at /etc/neo4j/neo4j.conf

try cd /var/lib/neo4j
That should change your to the home directory. Other than that I am not sure.

You can navigate your file system/folders with cd

if you run cd .. it will bring to the folder above, if you run cd ../../.. eventually you will get to the root folder. Hope that helps.

Hi Benjamin.

Thanks so much for the help!!! I found the home folder by cd /var/lib/neo4j (previously I thought cannot do this because I didn't see the var folder).
However, there is no bin folder in the directory.

I found the bin folder here: cd /usr/bin, from which I found the cypher-shell.
I don't know why there's no bin folder in the home directory though...

I think I should be able to pipe the script into the shell script then. THANKS SO MUCH for your help!!!

jgaskins
Ninja
Ninja

Absolutely. The docs have great installation instructions for Linux. After you install it, make sure you have these lines set in your /etc/neo4j/neo4j.conf:

dbms.connectors.default_listen_address=0.0.0.0 # Listen for remote connections
dbms.connector.bolt.enabled=true
dbms.connector.https.enabled=true

I would recommend setting dbms.connector.http.enabled=false so you're not sending credentials and data over the wire in plaintext — use https on port 7473 instead. You don't need to worry about the certificate warnings, your connection is encrypted even with a self-signed cert (created by default, so you don't even need to do that yourself).

What do you mean by automatically? Is the self-signed-cert created by neo4j when starting it with HTTPS enabled ?

I just installed on Ubuntu and I am having trouble getting the .conf to take effect. I restart neo4o after each change, but it is quite random what config settings seem to be active. Perhaps I am missing something. Mayne it takes longer time for the conf to take effect or something. If I enable https, regular http stop working, but only sometimes. Very weird.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.