s3fs
s3fs is an open source utility for Linux and macOS. With s3fs, you can mount a container to a folder on your device and work with it as a regular folder while it is mounted.
Configure s3fs
1. Install the client
Use the Installation instructions in the s3fs-fuse GitHub.
2. Configure access
Access can be configured by a user with the Account Owner or User Administrator role.
-
Create a service user с role with access to the object store.If you are using a user with the Object Storage User role, the container must have a configured access policy.
-
Open the CLI.
-
In the
~/.passwd-s3fs
file, save the S3 key:echo <access_key>:<secret_key> > ~/.passwd-s3fs
Specify:
<access_key>
— field value Access key from S3 key;<secret_key>
— field value Secret key from the S3 key.
-
Restrict access to the
~/.passwd-s3fs
file:chmod 600 ~/.passwd-s3fs
3. Mount the container
The container will be mounted in a folder on your device. Each time the system reboots, the container will be unmounted.
You can:
- perform a one-time mount of the container after each manual reboot of the system;
- configure an automatic mount to be performed automatically each time the system boots.
One-time mounting
Automatic mounting
-
Open the CLI.
-
Create an empty folder:
mkdir ~/<local_folder>
Specify
<local_folder>
— folder name. -
Mount the container:
s3fs <container_name> <path> -o passwd_file=~/.passwd-s3fs -o allow_other -o use_path_request_style -o endpoint=<pool> -o url=https://<s3_domain>
Specify:
<container_name>
— container name;<path>
— path to the local folder where the container will be mounted;-o allow_other
— optional: a parameter that allows other users on the device to access the container folder. If you do not specify the parameter, only the current user can access the folder;-o use_path_request_style
— optional: parameter that enables Path-style addressing. If you do not specify the parameter, Virtual-Hosted addressing will be used Virtual-Hosted addressing;<pool>
— pool in which the object storage is located;<s3_domain>
— S3 API domain depends on pool in which the object storage is located.
-
Open the CLI.
-
Create an empty folder:
mkdir ~/<local_folder>
Specify
<local_folder>
— folder name. -
Open the
fstab
file:nano /etc/fstab
-
In the
fstab
file, add a line:s3fs#<container_name> <path> fuse allow_other,nonempty,passwd_file=~/.passwd-s3fs,use_path_request_style,endpoint=<pool>,url=https://<s3_domain> 0 0
Specify:
<container_name>
— container name;<path>
— path to the folder where the container will be mounted;allow_other
— optional: a parameter that allows other users on the device to access the container folder. If you do not specify the parameter, only the current user can work with the folder;use_path_request_style
— optional: parameter that enables Path-style addressing. If no parameter is specified, Virtual-Hosted addressing will be used Virtual-Hosted addressing;<pool>
— pool where the object storage is located;<s3_domain>
— S3 API domain depends on pool in which the object storage is located.
-
Close the file **(Ctrl+X **) and save your changes ( **Y **).