Skip to main content
Amazon Neptune provides fully managed graph database services with two options: Neptune Database (property graph) and Neptune Analytics (in-memory analytics).

Installation

Install Graphiti with Neptune support:

Prerequisites

  • Neptune Database Cluster or Neptune Analytics Graph
  • Amazon OpenSearch Serverless Collection (for fulltext search)
  • AWS Credentials configured with appropriate IAM permissions

Required IAM Permissions

Configuration

Environment Variables

.env

Neptune Database Setup

Connect to a Neptune Database cluster:

Neptune Analytics Setup

Connect to a Neptune Analytics graph:

Driver Implementation

The NeptuneDriver (graphiti_core/driver/neptune_driver.py:139) provides:
  • Dual Backend Support: Works with both Neptune Database and Neptune Analytics
  • OpenSearch Integration: Uses Amazon OpenSearch Serverless for fulltext search
  • AWS Authentication: Automatic IAM-based authentication via boto3
  • Managed Service: Fully managed, scalable graph infrastructure

Connection Parameters

Host Format

  • Neptune Database: neptune-db://<cluster-endpoint>
  • Neptune Analytics: neptune-graph://<graph-id>

OpenSearch Integration

Neptune uses Amazon OpenSearch Serverless for fulltext indexing. The driver automatically manages four indices:

Index Definitions

  1. node_name_and_summary: Entity node fulltext search
  2. community_name: Community node search
  3. episode_content: Episode content search
  4. edge_name_and_fact: Relationship fact search
Indices are automatically created during initialization:

Complete Example

When to Use Neptune

Choose Neptune if you:
  • Need a fully managed, production-ready graph database
  • Want AWS-native integration and IAM security
  • Require high availability and automated backups
  • Need elastic scalability for varying workloads
  • Prefer serverless deployment options (Neptune Analytics)
Choose Neptune Database if you:
  • Need persistent storage with automatic backups
  • Want multi-AZ replication
  • Require read replicas for high read throughput
Choose Neptune Analytics if you:
  • Need fast in-memory analytics
  • Want to pay only for query execution time
  • Require rapid scaling for analytical workloads

Performance Considerations

  • Cold Starts: OpenSearch index creation takes ~60 seconds
  • Batch Operations: Use bulk operations for large data imports
  • Connection Pooling: Driver manages connection pooling automatically
  • Query Optimization: Monitor CloudWatch metrics for query performance

Monitoring and Debugging

CloudWatch Metrics

Monitor Neptune through CloudWatch:
  • Query execution time
  • Connection count
  • Storage usage (Database only)
  • Request count

Enable Query Logging

Cost Optimization

  • Neptune Database: Use instance sizing based on workload
  • Neptune Analytics: Pay per query; optimize query patterns
  • OpenSearch Serverless: Configure appropriate OCU (capacity units)
  • Data Transfer: Minimize cross-region data transfer

Security Best Practices

  • IAM Roles: Use IAM roles instead of access keys when possible
  • VPC Configuration: Deploy Neptune in private subnets
  • Encryption: Enable encryption at rest and in transit
  • Network Security: Use security groups to restrict access