首页 > 解决方案 > 无法连接到端点 aws

问题描述

尝试使用 Amazon Comprehend 时出现错误: botocore.exceptions.EndpointConnectionError:无法连接到终端节点 URL:“ https://comprehend.region.amazonaws.com/

我尝试在谷歌上搜索解决方案,但stuckoverflow 没有找到适合我的解决方案..

尝试将默认区域名称设置为 [us-east-1] ,我发现为其他人工作的更多内容对我不起作用

comprehend = boto3.client(service_name='comprehend', region_name='region')
json.dumps(comprehend.detect_dominant_language(Text=t), sort_keys=True, indent=4)

标签: pythonamazon-web-servicesunix

解决方案


区域名称必须是 AWS 的区域代码名称之一,例如“us-east-1”代表北弗吉尼亚州,“eu-west-1”代表爱尔兰等...

地区列表可在此处获得

https://docs.aws.amazon.com/general/latest/gr/rande.html

所以你的代码应该是

comprehend = boto3.client(service_name='comprehend', region_name='us-east-1')
json.dumps(comprehend.detect_dominant_language(Text=t), sort_keys=True, indent=4)

推荐阅读