s3fs
s3fs is an open source utility for Linux and macOS. With s3fs you can mount a bucket to a folder on your device and work with it as a normal 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 S3.If you are using a user with the S3 User role, the baket 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 baquette
The container will be mounted in a folder on your device. The container will be unmounted each time you reboot the system.
You can:
- perform a one-time mount of the bucket 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 baquette:
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 the 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 the parameter, Virtual-Hosted addressing will be used Virtual-Hosted addressing;<pool>
— pool where S3 is located;<s3_domain>
— S3 API domain depends on pool in which S3 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#<bucket_name> <path> fuse allow_other,nonempty,passwd_file=~/.passwd-s3fs,use_path_request_style,endpoint=<pool>,url=https://<s3_domain> 0 0
Specify:
<bucket_name>
— bucket name;<path>
— path to the folder where the bucket will be mounted;allow_other
— optional: parameter that allows other users on the device to access the bucket folder. If you do not specify the parameter, only the current user will be able to 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 S3 is located;<s3_domain>
— S3 API domain depends on pool in which S3 is located.
-
Close the file **(Ctrl+X **) and save your changes ( **Y **).