I have the following lambda code to try to access Neptune from the same VPC on AWS. Which most copied from https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-python.html.
But I am getting 403 Forbidden error.
The source code:
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.process.traversal import T
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
wss = 'wss://{}:{}/gremlin'.format(host, port)
remoteConn = DriverRemoteConnection(wss, 'g')
print("wss--> {}".format(wss))
# grapch
graph = Graph()
g = graph.traversal().withRemote(remoteConn)
# get
info = g.V().hasLabel('my').outE().inV().path().toList()
print(info)
return info
Error traceback:
{
"errorMessage": "HTTP 403: Forbidden",
"errorType": "HTTPClientError",
"stackTrace": [
" File \"/var/task/gremlin_python/process/traversal.py\", line 58, in toList\n return list(iter(self))\n",
" File \"/var/task/gremlin_python/process/traversal.py\", line 48, in __next__\n self.traversal_strategies.apply_strategies(self)\n",
" File \"/var/task/gremlin_python/process/traversal.py\", line 573, in apply_strategies\n traversal_strategy.apply(traversal)\n",
" File \"/var/task/gremlin_python/driver/remote_connection.py\", line 149, in apply\n remote_traversal = self.remote_connection.submit(traversal.bytecode)\n",
" File \"/var/task/gremlin_python/driver/driver_remote_connection.py\", line 56, in submit\n result_set = self._client.submit(bytecode, request_options=self._extract_request_options(bytecode))\n",
" File \"/var/task/gremlin_python/driver/client.py\", line 127, in submit\n return self.submitAsync(message, bindings=bindings, request_options=request_options).result()\n",
" File \"/var/task/gremlin_python/driver/client.py\", line 148, in submitAsync\n return conn.write(message)\n",
" File \"/var/task/gremlin_python/driver/connection.py\", line 55, in write\n self.connect()\n",
" File \"/var/task/gremlin_python/driver/connection.py\", line 45, in connect\n self._transport.connect(self._url, self._headers)\n",
" File \"/var/task/gremlin_python/driver/tornado/transport.py\", line 40, in connect\n self._ws = self._loop.run_sync(\n",
" File \"/var/task/tornado/ioloop.py\", line 576, in run_sync\n return future_cell[0].result()\n"
]