s3fs
s3fs is an open-source program for Linux and macOS. With s3fs, you can mount a bucket to a folder on your device and work with it like a regular folder as long as it is mounted.
Configure s3fs
1. Install the client
Use the Installation instructions in the s3fs-fuse GitHub repository.
2. Configure S3 access
Access can be configured by the Account Owner or a user with the iam.admin role.
- Create a service user with a role with S3 access. If you use a service user with the
s3.user,object_storage_user, ors3.bucket.userrole, an access policy must be configured for the bucket, and its rules must allow access to this user. - Issue an S3 key to the user.
3. Create a file with keys
-
Open the CLI.
-
In the
~/.passwd-s3fsfile, save your S3 key:echo <access_key>:<secret_key> > ~/.passwd-s3fsSpecify:
<access_key>— the value of the Access key field from the S3 key;<secret_key>— the value of the Secret key field from the S3 key.
-
Restrict access to the
~/.passwd-s3fsfile:chmod 600 ~/.passwd-s3fs
4. Mount the bucket
The bucket will be mounted to a folder on your device. Each time the system reboots, the bucket will be unmounted.
You can:
- manually perform a one-time bucket mount after each system reboot;
- configure automatic mounting that will be performed automatically each time the system boots.
One-time mount
Automatic mount
-
Open the CLI.
-
Create an empty folder:
mkdir ~/<local_folder>Specify
<local_folder>as the folder name. -
Mount the bucket:
s3fs <bucket_name> <path> -o passwd_file=~/.passwd-s3fs -o allow_other -o use_path_request_style -o endpoint=<pool> -o url=https://<s3_domain>Specify:
<bucket_name>— the bucket name;<path>— the path to the local folder where the bucket will be mounted;-o allow_other— optional: a parameter that allows other users on the device to access the bucket folder. If you do not specify this parameter, only the current user will be able to work with the folder;-o use_path_request_style— optional: a parameter that enables Path-style addressing. If you do not specify this parameter, Virtual-Hosted addressing will be used;<pool>— the pool where S3 is located;<s3_domain>— the S3 API domain. The domain depends on the pool where S3 is located.