0

我正在从一个架构迁移,我在私有子网中有一个 Lambda,与一个具有 NatGateway 的公共子网交谈,由 API 网关 WebSocket 触发。现在我删除了 Nat 网关并插入了一个带有 VPC 链接的 VPC 端点。我在链接中找到的:https ://d1.awsstatic.com/whitepapers/private-api-best-practices.pdf

我的 VPC 终端节点当前的策略全部打开,我没有使用 Enable Private DNS Name ,因为在我的 VPC 中有另一个项目与 API Gateway 对话。

我的 API Gateway 触发了 Lambda,但无法响应返回消息。我的 lambda 超时。

在我的旧架构中,我的返回端点是https://{restapi-id}.execute-api.{region}.amazonaws.com/{stage},现在当我尝试响应时,它不适用于该端点。

我必须更改端点吗?

在我完成测试此连接之前,我的安全组和 NACL 非常开放。VPC Link 和 API Gateway Endpoint 配置了 Lambda 子网和 Lambda 安全组。

VPC Link 或 VPC Endpoint 是否缺少某些内容?

编辑:我在 ApiGateway 中激活了日志,在 lambda 日志之前它返回:

{
    "requestId": "em-5aGamaDDAdtd=",
    "ip": "",
    "caller": "-",
    "user": "-",
    "requestTime": "30/Apr/2021:17:57:42 +0000",
    "eventType": "MESSAGE",
    "routeKey": "lambda",
    "status": "504",
    "connectionId": "em-5abCDaaDBJtw="
}

客户端收到消息:

{
message: "Endpoint request timed out", connectionId: "enBZ-dFG2oAFDA4a=",…}

connectionId: "em-5abCDaaDBJtw="
message: "Endpoint request timed out"
requestId: "em-5aGamaDDAdtd="
4

1 回答 1

0

我发现了我的问题,我的 VPC 链接缺少与 API 网关的连接。在 AWS::ApiGatewayV2::Integration 中,我需要插入 VPC Link 的连接。

于 2021-05-03T14:07:12.677 回答