Python request in AWS Lambda timing out

The default value for timeout in Lambda is 3 seconds = 3000 microseconds. Go to Advanced settings and add 5 min. This could be the only issue, if the timeout happens exactly at 3 seconds. All other errors would take something more or less than that.


I encounter same timeout problem, the reason is below.

AWS document:

When you add VPC configuration to a Lambda function, it can only access resources in that VPC. If a Lambda function needs to access both VPC resources and the public Internet, the VPC needs to have a Network Address Translation (NAT) instance inside the VPC.

Maybe there are some error when you setting your VPC. I advice you can follow this blog to build NAT.