aws / amazon-neptune-gremlin-java-sigv4

A Gremlin client for Amazon Neptune that includes AWS Signature Version 4 signing.
Apache License 2.0
27 stars 17 forks source link

Connecting to Neptune Using the Gremlin Console with Signature Version 4 with Ubuntu #40

Open nelsonflorez11 opened 3 years ago

nelsonflorez11 commented 3 years ago

Hi, the repo https://github.com/aws/amazon-neptune-gremlin-java-sigv4.git is to connect the gremlin console to a neptune from an ec2(amazon linux ) is it possible from an ec2 with ubuntu?

krlawrence commented 3 years ago

Hi - it's basically just Java code. I have successfully used many of the Java utilities from various Linux distros and from a Mac. Are you having any specific issues when you try using the library with Ubuntu? The key points are that the EC2 instance needs to be in the same VPC as Amazon Neptune or have access to that VPC and must be able to generate the needed SigV4 credentials.

nelsonflorez11 commented 3 years ago

Hi, yes it is correct, I am facing problems to connect from EC2 with Ubuntu to neptune, I follow the steps in the following documentation. https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth-connecting-gremlin-console.html

  1. wget https://archive.apache.org/dist/tinkerpop/3.4.8/apache-tinkerpop-gremlin-console-3.4.8-bin.zip
  2. unzip apache-tinkerpop-gremlin-console-3.4.8-bin.zip
  3. git clone https://github.com/aws/amazon-neptune-gremlin-java-sigv4.git
  4. cd amazon-neptune-gremlin-java-sigv4
  5. git checkout $(git describe --tags git checkout v2.1.1)
  6. mvn package dependency:copy-dependencies
  7. cp target/{.jar,dependency/.jar} ../apache-tinkerpop-gremlin-console-3.4.8/lib
  8. rm ../apache-tinkerpop-gremlin-console-3.4.8/lib/netty-all-4.1.49.Final.jar
  9. cd ../apache-tinkerpop-gremlin-console-3.4.8
  10. wget https://www.amazontrust.com/repository/SFSRootCAG2.pem
  11. cd conf/
  12. vim neptune-remote.yaml
  13. cd ..
  14. bin/gremlin.sh

Error executing the command from the gremlin console

ERROR org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler
 - Could not process the response
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException:
Invalid handshake response getStatus: 400 Bad Request
at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.verify(WebSocketClientHandshaker13.java:274)
at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.finishHandshake(WebSocketClientHandshaker.java:302)
at org.apache.tinkerpop.gremlin.driver.handler.WebSocketClientHandler.channelRead0(WebSocketClientHandler.java:69)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
at io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler.channelRead(WebSocketClientExtensionHandler.java:127)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1486)
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1235)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1282)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Thread.java:748)
WARN  org.apache.tinkerpop.gremlin.driver.Cluster  - Using deprecated
SSL trustCertChainFile support
WARN  org.apache.tinkerpop.gremlin.driver.Cluster  - Using deprecated
SSL trustCertChainFile support

versions

mvn -version
Apache Maven 3.6.0
javac -version
javac 1.8.0_292
java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~18.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

The Neptune cluster has enabled

Availability
IAM db authentication
Enabled
Encryption
Encryption
Enabled

Telnet connection answers me correctly