0

I am trying to set up a Neptune database for an app that I am building. However Neptune can only be accessed via a websocket endpoint on the same VPC that is also initialized with Neptune.

There are some tutorials and explanations online like the second answer here, but these are all for SSH. The gremlin package that AWS instructs to install only allows websocket connections. Which I need to be able to write my code in Node.js, not just connect via over SSH.

So how do I this? Is it even possible? If not, is there locally hosted graph database I can use that has an identical structure to Neptune, and can just use a environment variable to switch the socket connection once my app is deployed to staging/production?

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
HunterWhiteDev
  • 141
  • 1
  • 6
  • Neptune also exposes an HTTPS connection. You still need to provide a way for your application to access the VPC however. The Gremlin JavaScript client can be used with Node.js or are you looking to just make XHR requests? – Kelvin Lawrence Apr 29 '23 at 19:29
  • I just want to be able to read and write data to and from Neptune from my NodeJS – HunterWhiteDev Apr 29 '23 at 20:33
  • follow these [steps](https://github.com/aws/graph-notebook/tree/main/additional-databases/neptune) and you will be able to call from your code. – Arby Sidi Apr 30 '23 at 14:19
  • I found a docker image that works for local development, now my question is, can elastic beanstalk communicate with neptune? Or do I have to do some roundabout way with trying to proxy out the connection? – HunterWhiteDev Apr 30 '23 at 14:32
  • The rules are similar regardless of where you connect from, your code needs to have access to the VPC that Neptune is using. In the case of Elastic Beanstalk, if it is using the same VPC as Neptune then things should just work. If it is using a different VPC then you will have to decide how you want those two VPCs to talk to each other. See also [here](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/vpc.html) and [here](https://docs.aws.amazon.com/neptune/latest/userguide/get-started-connect-ec2-other-vpc.html) – Kelvin Lawrence Apr 30 '23 at 15:52
  • Be sure also to take note of the [differences](https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html) between using a Gremlin Server (I'm assuming that's part of the Docker container you found) and Neptune. – Kelvin Lawrence Apr 30 '23 at 15:55
  • Right, I got beanstalk working, and thanks for this note – HunterWhiteDev Apr 30 '23 at 18:02

1 Answers1

1

Here was what I did that I found is the best solution:

  1. Use this docker image for testing local development: https://hub.docker.com/r/amothic/neptune

  2. If you are using elastic beanstalk to deploy your API (I am using Node.js) make sure you elastic beanstalk environment is using the same VPC as Neptune.

These worked for me. Tested code locally with the docker image, and deployed and got the same result with elastic beanstalk on the same VPC.

HunterWhiteDev
  • 141
  • 1
  • 6
  • 1
    It looks like the container image that you're using is pretty old, at this point. It is using Gremlin Server 3.4.1. I haven't looked at the gremlin-server.yaml file to see exactly how they've configured it, but I suspect it is nothing more than just native Gremlin Server. If so, you maybe better off using https://hub.docker.com/r/tinkerpop/gremlin-server. The latest version of Neptune supports TinkerPop 3.6.2, so use a Gremlin Server image of the same version. – Taylor Riggan May 01 '23 at 14:09
  • Thanks, I'll have to look into it. For now, this was a quick way to get my local dev environment up – HunterWhiteDev May 01 '23 at 22:14