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 as you would with a regular folder while it is mounted.
Configure s3fs
1. Install the client
Follow the Installation instructions in s3fs-fuse on GitHub.
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 access to S3. If you use a service user with the
s3.user,object_storage_userors3.bucket.userrole, the bucket must have a configured access policy 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 the S3 key:echo <access_key>:<secret_key> > ~/.passwd-s3fsSpecify:
<access_key>— value of the Access key field from the S3 key;<secret_key>— 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. The bucket will be unmounted each time the system restarts.
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>— 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>— bucket name;<path>— path to the local folder where the bucket will be mounted;-o allow_other— optional: 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: parameter that enables Path-style addressing. If you do not specify this parameter, Virtual-Hosted addressing will be used;<pool>— pool where S3 is located;<s3_domain>— S3 API domain. The domain depends on the pool where S3 is located.