Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 

Amazon Neptune Gremlin .NET SigV4

This project provides a custom library that extends the Apache TinkerPop Gremlin.NET client to enable AWS IAM Signature Version 4 signing for establishing authenticated connections to Amazon Neptune.

For example usage refer to: NeptuneGremlinNETSigV4Example.cs. This example shows how to leverage this library for establishing an authenticated connection to Neptune.

For general information on how to connect to Amazon Neptune using Gremlin and best practices, refer to the documentation.

Usage

A snippet of the code from NeptuneGremlinNETSigV4Example.cs:

var neptune_host = "neptune-endpoint"; // ex: mycluster.cluster.us-east-1.neptune.amazonaws.com
var neptune_port = 8182;

var gremlinServer = new GremlinServer(neptune_host, neptune_port);
var gremlinClient = new GremlinClient(gremlinServer, 
    webSocketConfiguration: new SigV4RequestSigner().signRequest(neptune_host, neptune_port));
var remoteConnection = new DriverRemoteConnection(gremlinClient);
var g = Traversal().WithRemote(remoteConnection);

The GremlinClient library accepts both a GremlinServer object as well as a webSocketConfiguration object that contains a custom configuration set for establishing the WebSocket connection to Amazon Neptune. The SigV4RequestSigner library fetchs IAM credentials using the FallbackCredentialsFactory API (which works similarly to the Java Default Credential Provider Chain), performs the proper Signature Version 4 signing of an http request, and creates the proper WebSocket configuration based on this signed http request. One can then pass this webSocketConfiguration to the GremlinClient to create the connection to Neptune.

Using within Amazon EC2

To use this library in an application hosted on EC2, be sure to assign a role to the EC2 instance with the proper permissions to access Amazon Neptune. This library will fetch the IAM role credentials from the EC2 metadata store. If an IAM role is not assigned to the instance, the library will look for the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SESSION_TOKEN environment variables or look for an AWS CLI credentials file at ~/.aws/credentials.

Using within AWS Lambda

To use this library in an application hosted in a Lambda function, be sure to assign a role to the EC2 instance with the proper permissions to access Amazon Neptune. Upon invocation, the Lambda function will import the IAM role's credentials into the following environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN. This library will use those environment variables to import the credentials and perform the request signing.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

About

A custom library for Amazon Neptune that enables AWS Signature Version 4 signing by extending the Apache TinkerPop Gremlin .NET client.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages