Linux – Automatically Mounting S3 Bucket Using s3fs on Amazon CentOS

fstablinuxs3fs

I have tried all the answers provided in similar questions but none is helpful.

I installed S3 Fuse so that I can mount S3 bucket. After the installation, I performed the following the steps:

I created the mount point for S3 bucket;
mkdir –p /var/s3fs-drive-fs

I am able to mount the S3 bucket in the new directory with the IAM role by running the following commands:
s3fs myresearchdatasets /var/s3fs-drive-fs -o iam_role=EC2-to-S3-Buckets-Role -o allow_other, and it works fine.

However, I found out that the bucket disappears each time I reboot the system, which means I have to run the command above to remount the S3 bucket each time after restarting the system.

I found the steps to complete an Automatic mount at reboot by editing the fstab file with the lines below

s3fs myresearchdatasets /var/s3fs-drive-fs fuse_netdev,allow_other,iam_role=EC2-to-S3-Buckets-Role,umask=777, 0 0

To check whether the fstab is working correctly, I tried mount /var/s3fs-drive-fs/

but I got the following errors, "mount: can't find /var/s3fs-drive-fs/ in /etc/fstab"

Can anyone help me please?

Best Answer

The first field should include the mount type and the bucket name, e.g.,

s3fs#mybucket /path/to/mountpoint fuse _netdev,allow_other 0 0

The s3fs README has other examples.