jkehler/awslambda-psycopg2

Read timed out error after 5 mins, and drop the connection

linusliu opened this issue · 5 comments

lambda function will drop the connection after 5 mins, with error message:
"errorType": "ReadTimeout",
"errorMessage": "HTTPSConnectionPool(host='lambda.us-east-1.amazonaws.com ', port=443): Read timed out. (read timeout=60)"

This is likely because you have some VPC misconfigurations inside your lambda function. Does your Lambda function have internet access or is it in a private vpc?

Thank you for your quick response.

  1. lambda function VPC setting is 'NO VPC';
    2)The security group setting for the RDS postgres instance is:
    Inbound/Outbound
    Type| Protocol|Port Range|Source
    All traffic | All | All | 0.0.0.0/0

Lambda functions don’t have internet access by default. You should put your database into a VPC and then grant the lambda function access to that VPC

In the RDS instance, we already set VPC: vpc-791ae516 , and In Lambda function , the role has AmazonRDSFullAccess permission, any else permission I should grant?

If your RDS instance is in a VPC, your Lambda function needs to be in the same VPC so that it can access it. The role is more about permissions, not about networking configuration. In your Lambda configuration, set the same vpc + subnets.