错误 AWS Lambda SDK:名称解析暂时失败
ERROR AWS Lambda SDK: Temporary failure in name resolution
在突发应用程序过程中的 AWS lambda 中。我们在 VPC 中创建并 运行 大约 4k lambda。此 lambda 将文件从一个 AWS 账户复制到另一个。在 > 4k、<5k 的调用爆发期间,我们注意到所有 boto3 客户端帐户开始失败。
在某些时候我们开始收到
urllib3.exceptions.NewConnectionError:
<botocore.awsrequest.AWSHTTPSConnection object at 0x7fab54f6ae20>:
Failed to establish a new connection: [Errno -3] Temporary failure in
name resolution botocore.exceptions.EndpointConnectionError: Could not
connect to the endpoint URL: "https://.s3.amazonaws.com/"
接着是之前成功的,现在也报错:
Recieved following error
n Could not connect to the endpoint URL: "https://sts.amazonaws.com/"
[ERROR] 2020-11-02T18:50:05.867Z b2bc9529-0ea5-40f1-ba0e-98d9cf26eb2c
Recieved following error n Could not connect to the endpoint URL:
"https://sts.amazonaws.com/"
爆发后这些错误消失。
我想知道这里的问题是什么,以便我可以开始解决这个问题,但我不知道从哪里开始寻找?
我确实发现了这个问题,这似乎是我的问题:Occasional 'temporary failure in name resolution' while connecting to AWS Aurora cluster 虽然有了这个答案,我不清楚当我无法再连接到 AWS 服务时我到底该怎么办?
查看 VPC 流日志,我在此时间范围内使用以下日志记录:
2 unknown eni-034e0bc6a93976fcb - - - - - - - 1604344032 1604344205 -
NODATA
和
2 unknown eni-034e0bc6a93976fcb 10.XXX.XX.XXX 10.XXX.XX.XXX 45844 2049
6 10 866 1604344061 1604344176 ACCEPT OK
但我不知道这是什么意思,也不知道它是否表示有问题。
听起来像是 DNS 请求配额问题。参见 DNS quotas。
另外,请参阅 Occasional 'temporary failure in name resolution' while connecting to AWS Aurora cluster 以了解讨论和一些建议的解决方案。
感谢您对我对问题的回答的反馈:Occasional 'temporary failure in name resolution' while connecting to AWS Aurora cluster. Since the time I posted that answer, we have tackled the problem by increasing the number of ENIs created by AWS Hyperplane。
正如您所暗示的,并且 jarmod 指出:每个 ENI 可以在一秒内发送到 Amazon Route 53 解析器的数据包的最大数量 - 1024。
有趣的是,虽然这个数字是 硬性限制 ,但它是相对于单个 ENI 而言的。因此,增加 ENI 的数量将允许您每秒向 Amazon Route 53 Resolver 发送更多数据包。 Lambda 使用的 ENI 数量可以通过增加 VPC 中 security group:subnet 组合 的数量来增加。实现此目的的两种方法是:
- 将不同的安全组附加到不同的 Lambda 函数
- 在多个子网中托管您的 Lambda 函数
最后,了解 AWS Hyperplane 如何以及何时创建 ENI 很重要:
Hyperplane now creates a shared network interface when your Lambda function is first created or when its VPC settings are updated, improving function setup performance and scalability. This one-time setup can take up to 90 seconds to complete
有关 AWS Hyperplane、安全性 group:subnet 组合 及其与 ENI 的关系的更多信息,请参阅 Improved VPC Networking for AWS Lambda Functions。
爱米奇 :)
在突发应用程序过程中的 AWS lambda 中。我们在 VPC 中创建并 运行 大约 4k lambda。此 lambda 将文件从一个 AWS 账户复制到另一个。在 > 4k、<5k 的调用爆发期间,我们注意到所有 boto3 客户端帐户开始失败。
在某些时候我们开始收到
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x7fab54f6ae20>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://.s3.amazonaws.com/"
接着是之前成功的,现在也报错:
Recieved following error
n Could not connect to the endpoint URL: "https://sts.amazonaws.com/" [ERROR] 2020-11-02T18:50:05.867Z b2bc9529-0ea5-40f1-ba0e-98d9cf26eb2c Recieved following error n Could not connect to the endpoint URL: "https://sts.amazonaws.com/"
爆发后这些错误消失。
我想知道这里的问题是什么,以便我可以开始解决这个问题,但我不知道从哪里开始寻找?
我确实发现了这个问题,这似乎是我的问题:Occasional 'temporary failure in name resolution' while connecting to AWS Aurora cluster 虽然有了这个答案,我不清楚当我无法再连接到 AWS 服务时我到底该怎么办?
查看 VPC 流日志,我在此时间范围内使用以下日志记录:
2 unknown eni-034e0bc6a93976fcb - - - - - - - 1604344032 1604344205 - NODATA
和
2 unknown eni-034e0bc6a93976fcb 10.XXX.XX.XXX 10.XXX.XX.XXX 45844 2049 6 10 866 1604344061 1604344176 ACCEPT OK
但我不知道这是什么意思,也不知道它是否表示有问题。
听起来像是 DNS 请求配额问题。参见 DNS quotas。
另外,请参阅 Occasional 'temporary failure in name resolution' while connecting to AWS Aurora cluster 以了解讨论和一些建议的解决方案。
感谢您对我对问题的回答的反馈:Occasional 'temporary failure in name resolution' while connecting to AWS Aurora cluster. Since the time I posted that answer, we have tackled the problem by increasing the number of ENIs created by AWS Hyperplane。
正如您所暗示的,并且 jarmod 指出:每个 ENI 可以在一秒内发送到 Amazon Route 53 解析器的数据包的最大数量 - 1024。
有趣的是,虽然这个数字是 硬性限制 ,但它是相对于单个 ENI 而言的。因此,增加 ENI 的数量将允许您每秒向 Amazon Route 53 Resolver 发送更多数据包。 Lambda 使用的 ENI 数量可以通过增加 VPC 中 security group:subnet 组合 的数量来增加。实现此目的的两种方法是:
- 将不同的安全组附加到不同的 Lambda 函数
- 在多个子网中托管您的 Lambda 函数
最后,了解 AWS Hyperplane 如何以及何时创建 ENI 很重要:
Hyperplane now creates a shared network interface when your Lambda function is first created or when its VPC settings are updated, improving function setup performance and scalability. This one-time setup can take up to 90 seconds to complete
有关 AWS Hyperplane、安全性 group:subnet 组合 及其与 ENI 的关系的更多信息,请参阅 Improved VPC Networking for AWS Lambda Functions。
爱米奇 :)