【问题标题】:Is there any python module through which I can mount a S3 bucket into a filesystem?是否有任何 python 模块可以通过它将 S3 存储桶安装到文件系统中?
【发布时间】:2020-03-23 12:11:25
【问题描述】:

s3fs-FUSE 是一个 CLI 工具,可以做到这一点 但 s3fs 库实际上并没有将其挂载到文件系统,而是为我们提供了将 S3 存储桶作为文件系统访问的 API

我正在寻找一些 python 库,我可以在我的 python 脚本中使用它来将 s3 存储桶安装到文件系统中。

【问题讨论】:

    标签: python amazon-s3 boto3 s3fs python-s3fs


    【解决方案1】:

    您可以使用基于 boto3 的同名 s3fs Python 库。

    【讨论】:

      【解决方案2】:

      您实际上可以挂载一个 S3 存储桶:

      您可以运行以下命令来挂载 s3fs。

      s3fs mybucket /path/to/mountpoint -o passwd_file=/etc/passwd-s3fs
      

      您还可以按照以下命令在启动时挂载 s3 存储桶。

      mkdir /tmp/cache
      
      mkdir /path/to/mountpoint
      
      chmod 777 /tmp/cache /path/to/mountpoint
      

      编辑/etc/fstab 并添加:

      s3fs#mybucket /path/to/mountpoint fuse allow_other,use_cache=/tmp/cache,uid=userid,gid=groupid 0 0
      

      如果你想在重启前挂载/etc/fstab

      mount -a
      

      在此处查看更多详细信息: https://github.com/s3fs-fuse/s3fs-fuse/blob/master/README.md https://medium.com/@linuxonze/mount-amazon-s3-bucket-aa069d9f6f0a

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-07-19
        • 1970-01-01
        • 2012-04-20
        • 1970-01-01
        • 1970-01-01
        • 2011-07-08
        • 2022-01-28
        相关资源
        最近更新 更多