使用s3fs-fuse在AWS Linux實例上掛載S3存儲桶

一、安裝s3fs-fuse以及依賴包

    1. 安裝依賴包

On CentOS7 or AMI Linux 7:

# yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel

On Ubuntu 14.04 or later:

$ sudo apt-get install automake autotools-dev fuse g++ git libcurl4-openssl-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

    2. 安裝s3fs-fuse

# cd /usr/local/
# git clone https://github.com/s3fs-fuse/s3fs-fuse.git
# cd s3fs-fuse
# ./autogen.sh
# ./configure
# make
# make install


二、導入IAM用戶身份憑證

IAM->用戶(具有S3權限的用戶)->安全證書->創建訪問密鑰->下載文件到本地

# echo MYIDENTITY:MYCREDENTIAL >  ~/.passwd-s3fs
# chmod 600  ~/.passwd-s3fs


三、掛載S3存儲桶到本地

    1. 手動掛載

# mkdir /mnt/s3
# s3fs -o passwd_file=~/.passwd-s3fs -o endpoint=us-east-2 -o allow_other mybucket_name /mnt/s3

    2. 寫入/etc/fstab開機自動掛載

# vim /etc/fstab
mybucket_name /mnt/s3 fuse.s3fs _netdev,allow_other 0 0


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章