0

s3fs-FUSE is a CLI tool which can do this But s3fs library does not actually mount it to the filesystem, instead it gives us apis to access the S3 buckets as file system

I'm looking for some python library which I can use in my python script to mount a s3 bucket into a filesystem..

2 Answers2

1

You can use the similarly-named s3fs Python library based on boto3.

Andrew Gaul
  • 2,296
  • 1
  • 12
  • 19
0

You can actually mount a S3 bucket:

You can run the below command to mount s3fs.

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

You can also mount the s3 bucket on boot by following below commands.

mkdir /tmp/cache

mkdir /path/to/mountpoint

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

Edit /etc/fstab and add:

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

If you want to mount /etc/fstab before reboot:

mount -a

Check more details here: https://github.com/s3fs-fuse/s3fs-fuse/blob/master/README.md https://medium.com/@linuxonze/mount-amazon-s3-bucket-aa069d9f6f0a

Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179