Gremlinpython 3.4.X to Neptune with IAM Authentication

391 views
Skip to first unread message

Roi Talpaz

unread,
Nov 2, 2021, 11:50:25 AM11/2/21
to Gremlin-users
Hi all!

I want to authenticate with AWS Neptune using IAM.

I was able to implement the SigV4 Mechanism using the example here:
https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth-connecting-python.html
and also https://github.com/triggan/neptune-python-sigv4-ws

But it seems it does not support refreshing of the token, timestamps and so on for long (few days) WebSocket sessions.

I saw that there is this library created by folks at AWS
https://github.com/awslabs/amazon-neptune-tools/tree/master/neptune-python-utils

This looks great but it does not support gremlin-python 3.4.x even though Neptune only support up until gremlin-python 3.4.11 :S

Stephen Mallette

unread,
Nov 4, 2021, 3:04:01 PM11/4/21
to gremli...@googlegroups.com
Did you try the 3.5.1? As you've noted, Neptune doesn't officially support it just yet but as long as you stick to 3.4.x Gremlin syntax it might help move you along.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/d618d91e-9f91-4e74-aa82-be2e3b8fccfdn%40googlegroups.com.

Roi Talpaz

unread,
Nov 7, 2021, 4:59:12 AM11/7/21
to Gremlin-users
I didn't try, but I am a bit worried it will cause unexpected issues :S

Has anyone tried using 3.5 and Neptune here and care to comment?

Kelvin Lawrence

unread,
Nov 8, 2021, 9:34:34 AM11/8/21
to Gremlin-users
Hi there - I have been using the 3.5.1 Gremlin Python client with Neptune regularly. We also just moved the graph-notebook project up to that same Python client level. There are a few things to be aware of. 
  1. If you use the client inside a Jupyter Notebook and create your own connections, you will need to create the DriverRemoteConnection as shown below.
  2. The 3.5.x client no longer uses Tornado. It uses AIO HTTP. This solves a lot of issues we have had in the past with the Gremlin Python client and Jupyter's event loop. As part of your SigV4 Signing, if you call any Tornado methods, just use the equivalent ones from Requests/AIO HTTP instead.
connection = DriverRemoteConnection(endpoint,'g',
                 transport_factory=lambda:AiohttpTransport(call_from_event_loop=True))

Happy to help more if you have any follow up questions.

Cheers,
Kelvin
Reply all
Reply to author
Forward
0 new messages