"errorType": "OperationalError"

0

"errorMessage": "connection to server at "*******.amazonaws.com" (3.7.109.5), port 5432 failed: Connection timed out\n\tIs the server running on that host and accepting TCP/IP connections?\n",   "errorType": "OperationalError",   "stackTrace": [     "  File "/var/task/lambda_function.py", line 14, in lambda_handler\n    conn = psycopg2.connect(\n",     "  File "/opt/python/psycopg2/init.py", line 122, in connect\n    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)\n"

Please help me out with this error.

How can we resolve it. Thanks

1 Answer
0

From the error it looks like you are getting a timeout error trying to connect to PostgreSQL from Lambda.
Please set the inbound rule of the security group of the EC2 or RDS running PostgreSQL to allow connections from Lambda.
For example, it may be possible to solve this problem by using the security group set up in Lambda as the source and putting a setting to allow inbound PostgreSQL security groups.

profile picture
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions