Skip to main content

s3fs

Last update:

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.
  2. Configure S3 access.
  3. Create a file with keys.
  4. Mount the bucket.

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.

  1. Create a service user with a role with S3 access. If you use a service user with the s3.user, object_storage_user, or s3.bucket.user role, an access policy must be configured for the bucket, and its rules must allow access to this user.
  2. Issue an S3 key to the user.

3. Create a file with keys

  1. Open the CLI.

  2. In the ~/.passwd-s3fs file, save your S3 key:

    echo <access_key>:<secret_key> > ~/.passwd-s3fs

    Specify:

    • <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.
  3. Restrict access to the ~/.passwd-s3fs file:

    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.
  1. Open the CLI.

  2. Create an empty folder:

    mkdir ~/<local_folder>

    Specify <local_folder> as the folder name.

  3. 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.