Skip to content

Instantly share code, notes, and snippets.

@AlejandroJL
Forked from tejasbubane/s3_bucket_mount.sh
Created June 24, 2018 05:25
Show Gist options
  • Save AlejandroJL/d8dc999860ef4fee8059d10ef04536ef to your computer and use it in GitHub Desktop.
Save AlejandroJL/d8dc999860ef4fee8059d10ef04536ef to your computer and use it in GitHub Desktop.
Steps to be done for mounting s3 bucket on an amazon ec2 instance
# download the proper versions of s3fs and fuse
wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.8.4/fuse-2.8.4.tar.gz
# unpack them
tar -xzf s3fs-1.61.tar.gz
tar -xzf fuse-2.8.4.tar.gz
# install dependencies
yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel openssl-devel mailcap glibc-devel.i386
# s3fs require fuse so install it first
cd fuse-2.8.4
./configure --prefix=/usr
make
make install
# now install s3fs
cd ../s3fs-1.61
./configure --prefix=/usr
make
make install
# make credentials file and give it proper permissions
vi /etc/passwd-s3fs
#enter the credentials in this file format is access_id:secret_key
chmod 600 /etc/passwd-s3fs
# All done ready to mount
mkdir /s3-bucketname
s3fs -o default_acl=public-read <bucket> <mountpoint>
# if you get error saying cannot load shared library libfuse.so.2:
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/
# and now run the previous command again. Yay! the bucket is mounted!
# verify bucket is mounted properly using `df -h`
# reference: http://www.goworkday.com/2013/08/01/s3fs-installation-on-centos-6-3-ec2/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment