How can I visualize a Gremlin graph from Amazon Neptune with Graphexp?

3 minute read

I want to use Graphexp to visualize a Gremlin graph that's stored in Amazon Neptune. How can I do that?

Short description

To use Graphexp to visualize a Gremlin graph, complete the following prerequisites:

1.    Create a Neptune DB cluster.

2.    Create an Amazon Elastic Compute Cloud (Amazon EC2) Linux instance in the same virtual private cloud (VPC) as the Neptune cluster. Be sure that the instance is accessible from your local computer through an SSH connection.

3.    Create a VPC security group that allows the EC2 instance to connect to the Neptune cluster from within the VPC. For more information, see Accessing Neptune DB clusters in an Amazon VPC.

4.    Confirm that your AWS Identity and Access Management (IAM) authentication is disabled.

5.    On the EC2 instance, install the Gremlin console and connect to Neptune.

Note: If the neptune_enforce_ssl parameter is set to "true" for your database, then use an HTTPS (wss) connection. Or if you use REST over HTTPS, set your REST_USE_HTTPS parameter to "true". Otherwise, you receive a connection error. For more information, see Encryption in transit: Connecting to Neptune using SSL/HTTPS.


Load the Gremlin graph

Note: The following examples use the property graph from the Apache TinkerPop GitHub documentation.

In the Gremlin console, perform the following steps:

1.    Add the vertices:


2.    Add the edges:


Set up the SSH tunnel

The SSH tunnel allows your local computer to connect to the EC2 server and then connect to the Neptune instance using local port forwarding. You can create the SSH tunnel using an SSH client or PuTTY.

To connect using an SSH client, run the following command. The example uses these values:

8182: the port for the Neptune cluster the Neptune cluster endpoint
my_keypair.pem: your private key pair file the public DNS hostname of the EC2 instance

ssh -L -i my_keypair.pem


1.    In the Category pane, choose Session, and then complete the following fields:
For Host Name, enter the public DNS hostname of the EC2 instance.
For Port, be sure that the value is 22.

2.    In the Category list, expand Connection > SSH, and then choose Tunnels. Complete the following fields:
For Source port, enter the port that you chose when you created the Neptune cluster, such as 8182.
For Destination, enter the Neptune cluster endpoint and port. Example:
Select the Local and Auto options.

3.    Choose Add, and then choose Open. When the session opens, an event log appears:

[timestamp] Local port 8182 forwarding to

Set up Graphexp

1.    Download the Graphexp package from GitHub.

2.    Extract the zip file on your local file system.

3.    Open the scripts/graphConf.js file and set the following parameters:

const host = "localhost";

Access the Neptune graph in your browser

1.    In your browser, enter the path to the graphexp.html file in the unzipped Graphexp directory. For example:


2.    Choose Get graph info and then choose Search to load and display the Gremlin graph.

Related information

Accessing the Neptune graph with Gremlin

Using Gremlin to access the graph

AWS OFFICIALUpdated 3 years ago