ValueError: Invalid endpoint: https://s3..amazonaws.com when initiating s3 client
See original GitHub issueHey, hope its not a duplicate issue but when I’m trying to initialise s3 client I sometimes get the following error:
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
Any idea why it can happen?
(Versions: boto3==1.7.29, botocore==1.10.29)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
ValueError: Invalid endpoint: https://s3..amazonaws.com
It looks like you have an invalid region. Check your ~/.aws/config.
Read more >ValueError Invalid endpoint https s3 amazonaws com - Edureka
When an EMR machine is trying to run a step that includes boto3 initialization it sometimes gets the following error: ValueError: Invalid ......
Read more >Invalid Endpoint Error in AWS CLI [Solved] | bobbyhadz
The "Invalid endpoint" error occurs when the region that applies to the AWS CLI command is not set properly and most often is...
Read more >Getting an invalid endpoint error after updating my region ...
I am trying to copy a file from my computer to AWS S3 from my command line. Invalid endpoint: https://s3..amazonaws.com I updated my...
Read more >Troubleshoot Could not connect to endpoint URL error when I ...
Troubleshoot Could not connect to endpoint URL error when I run the sync command on S3 bucket error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For those who reach this issue via search engine:
export AWS_DEFAULT_REGION='<your-default-region>'
should do the trick.FWIW, it’s a workaround that will override your config settings in
~/.aws/config
file.It’s a mystery to me via
boto3.client('iam')
works butboto3.client('sts')
won’t. I tried it with all versions of boto3 from latest 1.14.17 till 1.9.0. Theboto3.client('sts')
fails for all. But the code path should be same for both client calls as the error stems from the session creation code.The culprit is
endpoint_region_name
variable in botocore’s session module which takes value of an empty string''
, raising an exception.🤷
Thanks, the environment variable fix helped when getting this exception with EC2