gremlinamazon-neptunegremlinnet

Connecting to AWS Neptune with Gremlin.net from a local windows machine


I'm following Amazon's documentation at access-graph-gremlin-dotnet and trying to run it on a local windows machine that is connected to Neptune with an SSH tunnel through an EC2 instance.
I've tested the SSH tunnel with gremlin console and it works fine.
Running the program on an EC2 instance works as well, but when running the program on a local windows machine I'm getting the following exception because the Neptune's certificate needs to be added to trusted certificates:

System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> 
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner 
 exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is 
invalid according to the validation procedure.

I'm searching for how to do so in Gremlin.Net 3.4.6 (preferable C#).


Solution

  • You will need to do this:

    1. Open cmd.exe as an Administrator
    2. notepad c:\windows\system32\drivers\hosts
    3. add a line 127.0.0.1 <your neptune cluster endpoint just the name without port>
    4. Save the file
    5. Now try and run the .Net code again

    This is because you are most likely connecting to localhost and the certificate is signed for the cluster's hostname, so there is a mismatch.