Neptune

Amazon Neptune

The Neptune API provides a graph database to store nodes and edges that can be accessed via Apache TinkerPop and Gremlin queries.

For example, you can create a Neptune cluster like this:

  1. import boto3
  2. from gremlin_python.driver import client as gremlin_client
  3. client = boto3.client('neptune', endpoint_url='http://localhost:4566')
  4. cluster = client.create_db_cluster(DBClusterIdentifier='c1', Engine='neptune')['DBCluster']
  5. cluster_url = 'ws://localhost:%s/gremlin' % cluster['Port']
  6. graph_client = gremlin_client.Client(cluster_url, 'g')

… and then submit and query values to the DB like this:

  1. values = '[1,2,3,4]'
  2. result_set = graph_client.submit(values)
  3. results = result_set.all().result()
  4. assert results == [1, 2, 3, 4]

For a simple Neptune sample running on LocalStack, please refer to this Github repository.

Last modified October 8, 2021: rename Local AWS Services to aws (fa6b2e4a)