2016年3月1日 星期二

[AWS] - EC2 + S3

@ 到S3後台建立一個 Toky 的 Buket g1101























# sudo -s ( 小心使用 ><" )
# cd /root/
# apt-get install build-essential git libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool
# apt-get install pkg-config libssl-dev
# git clone https://github.com/s3fs-fuse/s3fs-fuse
# cd s3fs-fuse/
# ./autogen.sh
# ./configure --prefix=/usr --with-openssl
# make
# make install

# vim /etc/passwd-s3fs
#<AWS Access Key ID>:<AWS Secret Access Key>
AxxxxxxxxxxxxxxUA:vxxxxxxxxxxxxxxx+1






# chmod 640 /etc/passwd-s3fs
# mkdir /tmp/cache
# chmod 777 /tmp/cache
# mkdir /mnt/s3
# s3fs -o use_cache=/tmp/cache g1101 /mnt/s3

@ 查看 >< 有 256T
# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            492M   12K  492M   1% /dev
tmpfs           100M  348K   99M   1% /run
/dev/xvda1      7.8G  1.6G  5.9G  21% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            497M     0  497M   0% /run/shm
none            100M     0  100M   0% /run/user
s3fs            256T     0  256T   0% /mnt/s3


@ 如果要讓這個目錄可以讓 web User ( apache or www-data  )  存取到
要加上 allow_other

# s3fs -o allow_other,use_cache=/tmp/cache g1101 /mnt/s3

@ 自動開機 mount 加到 fstab or 寫到 /etc/rc.local

# vim /etc/fstab
s3fs#mybucket /mnt/s3 fuse allow_other,use_cache=/tmp/cache 0 0

@ Umount S3 Drive

# fusermount -u /mnt/s3

沒有留言:

張貼留言