Open Amazon Neptune Console: In the AWS Management Console, find and select Amazon Neptune.
Launch a New Database: Click on "Create Database." Fill in the necessary details:
Keep rest all values as default.
Open the Amazon EC2 Console.
Launch Instance: From the dashboard, select "Launch instance".
Name Your Instance: Enter a descriptive name under "Name and tags".
Select OS Image:
Choose Instance Type:
t2.micro
(default) or t3.micro
in regions where t2.micro
is unavailable, both eligible for the Free Tier.Configure Key Pair:
Network Settings:
Launch:
Open the Amazon EC2 console.
In the navigation pane, choose Instances.
Select the instance and choose Connect.
Choose EC2 Instance Connect.
Verify the user name and choose Connect to open a terminal window.
sudo yum install java-11-amazon-corretto-devel
sudo /usr/sbin/alternatives --config java
wget https://archive.apache.org/dist/tinkerpop/3.6.5/apache-tinkerpop-gremlin-console-3.6.5-bin.zip
unzip apache-tinkerpop-gremlin-console-3.6.5-bin.zip
cd apache-tinkerpop-gremlin-console-3.6.5
cat > conf/neptune-remote.yaml << EOF
hosts: [$NEPTUNE_ENDPOINT]
port: 8182
connectionPool: { enableSsl: true }
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
config: { serializeResultToString: true }}
EOF
In the conf
subdirectory of the extracted directory, create a file named neptune-remote.yaml
with the following text. Replace your-neptune-endpoint
Change directories into the unzipped directory.
Unzip the Gremlin Console zip file.
Download the appropriate version of the Gremlin console from the Apache web site.
Enter the following to set Java 11 as the default runtime on your EC2 instance.
Install Java. If you're using Amazon Linux 2023 (AL2023).
export NEPTUNE_ENDPOINT=example-neptune-endpoint
bin/gremlin.sh
:remote connect tinkerpop.server conf/neptune-remote.yaml
:remote console
g.V().limit(1)
g.addV('person').property('name', 'justin')
g.addV('person').property(id, '1').property('name', 'martin')
g.V('1').property(single, 'name', 'marko')
Add a vertex with custom id.
Add vertex with label and property.
Enter the following to send a query to the Gremlin Graph.
At the gremlin>
prompt, enter the following to switch to remote mode. This sends all Gremlin queries to the remote connection.
At the gremlin>
prompt, enter the following to connect to the Neptune DB instance.
Enter the following command to run the Gremlin Console.
Change property or add property if it doesn't exist.
g.V('1').property('age', 29)
g.addV('person').property(id, '2').property('name', 'vadas').property('age', 27).iterate()
g.addV('software').property(id, '3').property('name', 'lop').property('lang', 'java').iterate()
g.addV('person').property(id, '4').property('name', 'josh').property('age', 32).iterate()
g.addV('software').property(id, '5').property('name', 'ripple').property('lang', 'java').iterate()
g.addV('person').property(id, '6').property('name', 'peter').property('age', 35)
g.V('1').addE('knows').to(__.V('2')).property('weight', 0.5).iterate()
g.addE('knows').from(__.V('1')).to(__.V('4')).property('weight', 1.0)
g.V('1').addE('created').to(__.V('3')).property('weight', 0.4).iterate()
g.V('4').addE('created').to(__.V('5')).property('weight', 1.0).iterate()
g.V('4').addE('knows').to(__.V('3')).property('weight', 0.4).iterate()
g.V('6').addE('created').to(__.V('3')).property('weight', 0.2)
Add property, but append property if property already has a value.
Add multiple vertices.
Add edges.
Add the rest of the Modern graph.
Delete a vertex.
g.V().has('name', 'justin').drop()
g.V().hasLabel('person')
g.V().has('name', 'marko').out('knows').valueMap()
g.addV("Label1::Label2::Label3")
g.V().property(single, 'lastUpdate', datetime('2018-01-01T00:00:00'))
Run a traversal.
Run a Traversal with values (valueMap()).
Specify multiple labels.
Specify Time/date.
Delete vertices, properties, or edges.
g.V().hasLabel('person').properties('age').drop().iterate()
g.V('1').drop().iterate()
g.V().outE().hasLabel('created').drop()
When you are finished, enter the following to exit the Gremlin Console.
:exit