Mount S3 Bucket
Bitstreams support mounting an S3 bucket that can be used to save files. The hosts /mnt
directory is configured as a shared mount point inside the docker containers.
Installation
To mount the S3 Bucket the following applications need to be installed.
sudo apt install s3fs
Setup
-
Create a directory under the
/mnt
locationsudo mkdir -p /mnt/s3bucket
-
Login into the AWS account and obtain an Access Key and Access ID.
-
Create a file to store the Access Key and Access ID
nano .passwd-s3fs
-
Update the permissions on the password file.
chmod 600 .passwd-s3fs
-
Paste the Access Key and Access ID into the file with the following syntax.
ACCESSKEY:ACCESSID
eg
DU6IAFSADMSI6OURYAKNF4X:uJL/Pw3U+w/odfcvasaRtuI9mI/E8c3R/p5L1TVVjfj -
Run the below command to mount the S3 Bucket.
If the server is rebooted, the S3 Bucket will no longer be mounted. See the next section to mount with fstab.
sudo s3fs <s3-bucket-name> /mnt/s3bucket -o passwd_file=.passwd-s3fs -o use_cache=/tmp -o allow_other -o umask=022 -o url=https://<region>.amazonaws.com
s3-bucket-name = Name of the S3 Bucket
region = Region the S3 bucket is located
Example:
sudo s3fs bitstreams-sse-s3 /mnt/s3bucket -o passwd_file=.passwd-s3fs -o use_cache=/tmp -o allow_other -o umask=022 -o url=https://s3.us-west-2.amazonaws.com
Mount with fstab
-
Copy the passwd file into the root home director
sudo cp ~/.passwd-3fs /root
-
Edit the fstab with
nano /etc/fstab
and add the following line.s3fs#<s3-bucket> /mnt/s3bucket fuse _netdev,allow_other,umask=022,url=https://<region>.amazonaws.com 0 0
s3-bucket-name = Name of the S3 Bucket
region = Region the S3 bucket is locatedExample:
s3fs#bitstreams-sse-s3 /mnt/s3bucket fuse _netdev,allow_other,umask=022,url=https://s3.us-west-2.amazonaws.com 0 0