1

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

如果我不设置endpoint_urlin会出现此错误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_urlins3fs.S3FileSystem()以指定区域。

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

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

提前感谢您的帮助。

4

0 回答 0