s3fs.S3FileSystem() 是否总是需要特定的区域设置?

问题描述

我想要做的是从我的 EC2 机器连接一个 s3 存储桶。

如果我没有在 endpoint_url 中设置 s3fs.S3FileSystem(),就会出现这个错误

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/s3fs/core.py",line 246,in _call_s3
    out = await method(**additional_kwargs)
  File "/usr/local/lib/python3.7/site-packages/aiobotocore/client.py",line 155,in _make_api_call
    raise error_class(parsed_response,operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/s3fs/core.py",line 1064,in _info
    out = await self._simple_info(path)
  File "/usr/local/lib/python3.7/site-packages/s3fs/core.py",line 984,in _simple_info
    **self.req_kw,File "/usr/local/lib/python3.7/site-packages/s3fs/core.py",line 265,in _call_s3
    raise translate_boto_error(err)
PermissionError: Access Denied

但是,我能够修复它在 endpoint_url添加 s3fs.S3FileSystem() 以指定区域。

s3 = s3fs.S3FileSystem(key=MYKEY,secret=SECRET,client_kwargs={
                           'endpoint_url':'https://s3.ap-northeast-2.amazonaws.com'
                           })

我想知道 s3fs 是否需要特定区域,因为文档中没有严格的指导..!

提前感谢您的帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)