简体   繁体   中英

"message": "Endpoint request timed out"}: AWS Lambda .net core: {

I always have {"message": "Endpoint request timed out"}.

I use swagger and swagger ui for api.

What I did:

  1. Created a mysql db in RDS
  2. Ensure everything works and is connected (Yes) with publicly accessibble
  3. Created a Lambda function to wrap my existing aspnet core project
  4. Added the custom runtime to support 2.2
  5. Published my lambda function
  6. Setup the permission between the vpc and the role
  7. When I try to access my lambda function I always have: {"message": "Endpoint request timed out"}

I think it's a small config I missed.

How can I investigate to understand what is the issue?

Would you have any ideas on the issue?

This timeout will be the result of a network connectivity issue.

I would start off by saying you should keep this network connectivity between your Lambda and your RDS private. If the RDS is public you would need to whitelist to allow a large range of IPs to allow inbound access (to cover all Lambdas in the region). This means any Lambda could connect to your RDS.

Instead you should keep the RDS as a private instance and configure your Lambda to operate within a VPC . Then when your Lambda connects to the RDS it will be connecting via the private network without traversing the public internet.

Finally ensure that the security group for your RDS allows inbound access from either the security group attached to the Lambda (this is decided when you add the Lambda to the VPC) or the subnet CIDR ranges the Lambda lives in.

If using API Gateway, it has a global timeout of 29 seconds for all Lambdas it serves, regardless of the Lambda timeout settings

Official docs under API Gateway quotas for configuring and running a REST API

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM