Connect to Neo4J hosted on a remote ec2 instance via python running on my current ec2 instance

Hello everyone!

I am getting started with NEO4J and I have made some good progress with the help of this community board. I have a confusion right now and would love for anyone to throw some light on that. So my NEO4J graph is up and running on a remote ec2 instance.
When I ssh into that remote instance and login to the cypher shell using this command:
"cypher-shell -u neo4j -p xxx", it shows me:
" Connected to Neo4j 4.0.0 at neo4j://localhost:7687".
So then I go to my browser and paste "neo4j://localhost:7687" which shows me an alert box and asks me if I want to open it in NEO4J Desktop version (on my local machine). When I click yes, I am able to get in. So to me, this means that I am able to remote access my graph. But when I am on my ec2 instance and using python, I am not able to connect to the graph.

My python code looks like this:

from neo4j import GraphDatabase
uri = "bolt://xx.xx.xx.xx:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "xxx"))

Can any one spot what the issue here is? I am getting an OS Error: OSError: [Errno 0] Error

On the EC2 box, have you've installed the python driver for Neo4j?

pip install neo4j

Since you've confirmed that through the desktop you can do a remote connection, do you get there same error when executing python remotely?

1 Like

Thanks for the response. Yes I had python drivers installed. The issue was something else that I just resolved. There needs to be a parameter parsed while creating the driver object (,..,encrypted=False) and that did the work for me.

2 Likes

Turning encryption off seems like a bad solution to the problem. Anyone have any other ideas how to fix this without turning off the encrypted connection?

I am having the same issue. Did you have any luck? I agree turning off encryption is a bad idea.

To use with encryption, you have to create a private key (probably with OpenSSL), create a certificate from that private key, and configure an SSL policy (example).
If you add a password to your private key, you will have to provide neo4j with that password via your SSL policy.
When I hit that error

1 Like