Mount s3 bucket to Linux operating system
Last updated
Last updated
To mount an S3 bucket to a Linux machine, you can use a tool like s3fs
Step 1: Install dependencies
Step 2: Store your credentials
Create a credentials file to store your access and secret keys securely
Replace ACCESS_KEY_ID
and SECRET_ACCESS_KEY
with your actual credentials.
Step 3: Create a mount point
Create a directory where the S3 bucket will be mounted:
Step 4: Mount S3-Compatible Storage with Path-Style Addressing
BUCKET_NAME
: Replace this with your actual bucket name.
/mnt/s3bucket
: The mount point where the bucket will be mounted.
-o passwd_file=~/.passwd-s3fs
: Specifies the path to the file where your credentials are stored (replace with your own credentials file path if necessary).
url=https://idr01.zata.ai with your S3-compatible service's endpoint .
allow_other
: Allows other users to access the mounted directory.
use_cache=/tmp
: Caches files locally in /tmp
to improve performance.
sigv4
: Forces Signature Version 4 signing (needed for most S3-compatible services).
use_path_request_style
: Forces path-style addressing, which is required for some S3-compatible service
Step 5: Verify the mount
Now you can try to create a new file on your system.
Copy that file to the S3 bucket in your Linux console.
Now back to the Zata.ai dashboard and click on the bucket section, select the bucket and check the content
To mount an S3-compatible bucket with path-style addressing permanently (so that it is automatically mounted at boot), you can add an entry to your /etc/fstab file. Here’s how to configure that:
Open /etc/fstab in an editor
Add an entry to mount your S3 bucket. The format should look like this:
Replace BUCKET_NAME
with your S3 bucket name.
Before rebooting, you can test if the mount entry in /etc/fstab works properly by running the following command
Verify the Mount :- To confirm that the bucket is mounted, list the contents of your mount point.
Reboot your machine to confirm that the S3 bucket mounts automatically after a system reboot: