I'm new working with AWS EKS and Pinotdb library in python.
Can someone help me?
I already have an AWS EKS cluster with Apache Pinot installed in it.
I want with a AWS lambda query the data and tables that already comes with the quick pinot start.
the code I started working is:
from pinotdb import connect
def lambda_handler(event, context):
conn = connect(host='MyHost', port=8099)
curs = conn.cursor()
curs.execute("select * from airlineStats air limit 10")
but this error always appears:
Response
{
"errorMessage": "[Errno -2] Name or service not known",
"errorType": "ConnectError",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 7, in lambda_handler\n curs.execute(\"select * from airlineStats air limit 10\")\n",
" File \"/opt/python/pinotdb/db.py\", line 57, in g\n return f(self, *args, **kwargs)\n",
" File \"/opt/python/pinotdb/db.py\", line 490, in execute\n **kwargs)\n",
" File \"/opt/python/httpx/_client.py\", line 1149, in post\n extensions=extensions,\n",
" File \"/opt/python/httpx/_client.py\", line 821, in request\n return self.send(request, auth=auth, follow_redirects=follow_redirects)\n",
" File \"/opt/python/httpx/_client.py\", line 912, in send\n history=[],\n",
" File \"/opt/python/httpx/_client.py\", line 939, in _send_handling_auth\n history=history,\n",
" File \"/opt/python/httpx/_client.py\", line 973, in _send_handling_redirects\n response = self._send_single_request(request)\n",
" File \"/opt/python/httpx/_client.py\", line 1009, in _send_single_request\n response = transport.handle_request(request)\n",
" File \"/opt/python/httpx/_transports/default.py\", line 218, in handle_request\n resp = self._pool.handle_request(req)\n",
" File \"/var/lang/lib/python3.7/contextlib.py\", line 130, in __exit__\n self.gen.throw(type, value, traceback)\n",
" File \"/opt/python/httpx/_transports/default.py\", line 77, in map_httpcore_exceptions\n raise mapped_exc(message) from exc\n"
]
}
Function Logs
START RequestId: f7dba952-efb5-4435-84cd-aaf2c8a9190d Version: $LATEST
[ERROR] ConnectError: [Errno -2] Name or service not known
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 7, in lambda_handler
curs.execute("select * from airlineStats air limit 10")
File "/opt/python/pinotdb/db.py", line 57, in g
return f(self, *args, **kwargs)
File "/opt/python/pinotdb/db.py", line 490, in execute
**kwargs)
File "/opt/python/httpx/_client.py", line 1149, in post
extensions=extensions,
File "/opt/python/httpx/_client.py", line 821, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/opt/python/httpx/_client.py", line 912, in send
history=[],
File "/opt/python/httpx/_client.py", line 939, in _send_handling_auth
history=history,
File "/opt/python/httpx/_client.py", line 973, in _send_handling_redirects
response = self._send_single_request(request)
File "/opt/python/httpx/_client.py", line 1009, in _send_single_request
response = transport.handle_request(request)
File "/opt/python/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
File "/var/lang/lib/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/opt/python/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
END RequestId: f7dba952-efb5-4435-84cd-aaf2c8a9190d
My lambda is configured with a role with: eks:* lambda:* ec2:*
and it's configure with the VPC and security groups as the EKS cluster has.
Can someone help me?