AWS BOTO3 SQS端点URL问题
我们有一个Lambda功能,将消息发送到SQS队列。 我们正在使用boto3。
我们已经建立了一个新的环境,Lambda正在私人子网上的VPC运行。 VPC终点是com.amazonaws.eu-west-2.sqs
lambda代码,
sqs = boto3.resource('sqs')
# Get the queue
queue = sqs.get_queue_by_name(QueueName=QueueID)
这给了我们以下错误 EndpointConnectionError:无法连接到端点URL:“ https://eu-west-2.queue.amazonaws.com/“
我们尝试了以下更改
sqs = boto3.client('sqs')
# Get the queue
queue = sqs.get_queue_url(QueueName=QueueID, QueueOwnerAWSAccountId='xxxxxxxxxxxx')
,我们遇到了相同的错误
,这是一个传统端点问题,但我们不知道如何在lambda函数中使用新端点。
We have a Lambda function that sends messages to SQS queue.
We are using boto3.
We have built a new environment and Lambda is running in a VPC on a private subnet.
The VPC end point is com.amazonaws.eu-west-2.sqs
Lambda code
sqs = boto3.resource('sqs')
# Get the queue
queue = sqs.get_queue_by_name(QueueName=QueueID)
This gives us the following error
EndpointConnectionError: Could not connect to the endpoint URL: "https://eu-west-2.queue.amazonaws.com/"
We have tried the following change
sqs = boto3.client('sqs')
# Get the queue
queue = sqs.get_queue_url(QueueName=QueueID, QueueOwnerAWSAccountId='xxxxxxxxxxxx')
We get the same error
It is a legacy endpoint issue but we do not know how to use the new endpoints in the Lambda function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为您使用的是SQS的VPC端点,因此需要覆盖BOTO3默认使用的地址。
这样的事情:
Because you're using a VPC endpoint for SQS you need to override the address that boto3 is using by default.
Something like this: