ValueError:无效的终结点:https://s3..amazonaws.com

时间:2019-09-15 10:05:11

标签: python amazon-web-services amazon-s3 boto3 amazon-emr

当EMR机器尝试运行包含boto3初始化的步骤时,有时会出现以下错误: ValueError: Invalid endpoint: https://s3..amazonaws.com 当我尝试安装新机器时,它可能突然工作。 附有完整错误:

self.client = boto3.client("s3")
  File "/usr/local/lib/python3.6/site-packages/boto3/__init__.py", line 83, in client
    return _get_default_session().client(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/boto3/session.py", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/usr/local/lib/python3.6/site-packages/botocore/session.py", line 861, in create_client
    client_config=config, api_version=api_version)
  File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 76, in create_client
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 285, in _get_client_args
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/usr/local/lib/python3.6/site-packages/botocore/args.py", line 79, in get_client_args
    timeout=(new_config.connect_timeout, new_config.read_timeout))
  File "/usr/local/lib/python3.6/site-packages/botocore/endpoint.py", line 297, in create_endpoint
    raise ValueError("Invalid endpoint: %s" % endpoint_url)
ValueError: Invalid endpoint: https://s3..amazonaws.com 

知道为什么会发生吗?

(版本:boto3 == 1.7.29,botocore == 1.10.29)

2 个答案:

答案 0 :(得分:0)

您的区域似乎无效。 Check您的〜/ .aws / config

答案 1 :(得分:0)

~/.aws/credentials~/.aws/config文件中设置区域。您还可以将区域设置为环境变量,例如

bash

export AWS_REGION="eu-west-2"

或在Powershell

$Env:AWS_REGION="eu-west-2"