简体   繁体   English

“消息”:“端点请求超时”}:AWS Lambda .net 核心:{

[英]"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.我将 swagger 和 swagger ui 用于 api。

What I did:我做了什么:

  1. Created a mysql db in RDS在 RDS 中创建了一个 mysql 数据库
  2. Ensure everything works and is connected (Yes) with publicly accessibble确保一切正常并与可公开访问的设备连接(是)
  3. Created a Lambda function to wrap my existing aspnet core project创建了一个 Lambda function 来包装我现有的 aspnet 核心项目
  4. Added the custom runtime to support 2.2添加了自定义运行时以支持 2.2
  5. Published my lambda function发布了我的 lambda function
  6. Setup the permission between the vpc and the role设置vpc和角色之间的权限
  7. When I try to access my lambda function I always have: {"message": "Endpoint request timed out"}当我尝试访问我的 lambda function 我总是有:{“消息”:“端点请求超时”}

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.我首先要说你应该保持 Lambda 和 RDS 之间的网络连接是私有的。 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).如果 RDS 是公共的,您需要将大量 IP 列入白名单以允许入站访问(以覆盖该区域中的所有 Lambda)。 This means any Lambda could connect to your RDS.这意味着任何 Lambda 都可以连接到您的 RDS。

Instead you should keep the RDS as a private instance and configure your Lambda to operate within a VPC .相反,您应该将 RDS 保留为私有实例,并将您的 Lambda 配置为在 VPC 中运行 Then when your Lambda connects to the RDS it will be connecting via the private network without traversing the public internet.然后,当您的 Lambda 连接到 RDS 时,它将通过专用网络连接,而无需遍历公共互联网。

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.最后确保您的 RDS 的安全组允许来自附加到 Lambda 的安全组的入站访问(这是在您将 Lambda 添加到 VPC 时决定的)或 Lambda 所在的子网 CIDR 范围。

If using API Gateway, it has a global timeout of 29 seconds for all Lambdas it serves, regardless of the Lambda timeout settings如果使用 API 网关,无论 Lambda 超时设置如何,它所服务的所有 Lambda 的全局超时为 29 秒

Official docs under API Gateway quotas for configuring and running a REST API API 网关配额下的官方文档用于配置和运行 REST API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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