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
Install the client
Use the instructions Installation on GitHub s3fs-fuse.
Configure access
Access can be configured by a user with role Account Owner or User Administrator.
-
Create a service user с a role with access to object storage. If you are using a user with the Object Storage User role, the container must be configured with the access policy.
-
Open the CLI.
-
In the file
~/.passwd-s3fs
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 file
~/.passwd-s3fs
:chmod 600 ~/.passwd-s3fs
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 work with the folder;-o use_path_request_style
— optional: parameter that enables Path-style addressing. If you do not specify a parameter, the following will be used Virtual-Hosted addressing;<pool>
— pool where the object storage is located;<s3_domain>
— S3 API domain depends on pool where the object storage is located.
-
Open the CLI.
-
Create an empty folder:
mkdir ~/<local_folder>
Specify
<local_folder>
— folder name. -
Open the file
fstab
:nano /etc/fstab
-
In the file.
fstab
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 you do not specify a parameter, the following will be used Virtual-Hosted addressing;<pool>
— pool where the object storage is located;<s3_domain>
— S3 API domain depends on pool where the object storage is located.
-
Close the file (Ctrl+X) and save your changes (Y).