Phanix

Just writing

使用 OSS 作為 alibaba cloud (aliyun) 的檔案系統

Alibaba cloud (aliyun) 上頭也有類似 gcp 的儲存服務,叫做 Object Storage Service (OSS),對於不常變更的檔案儲存算是便宜的選擇。

而要在 ec instance 上直接存取的話,可以用 ossfs來將 bucket mount 起來當作一般檔案系統使用。

$ sudo su
$ apt-get install gdebi-core
$ wget https://github.com/aliyun/ossfs/releases/download/v1.80.3/ossfs_1.80.3_ubuntu16.04_amd64.deb
$ gdebi ossfs_1.80.3_ubuntu16.04_amd64.deb 
$ apt-get install automake autotools-dev g   git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
$ echo [YOUR_OSS_BUCKET_NAME]:[YOUR_OSS_ACCESS_KEY_ID]:[YOUR_OSS_ACCESS_KEY_SECRET] > /etc/passwd-ossfs
$ mkdir /pkg-bucket
$ chmod 640 /etc/passwd-ossfs 
$ ossfs aiwatcher-pkg-bucket /pkg-bucket -ourl=http://[OSS_ENDPOINT_URL]
$ touch /pkg-bucket/test.txt
$ ll /pkg-bucket/
total 12
drwxr-xr-x  3 root         root      4096 Mar 21 14:54 ./
drwxr-xr-x 23 root         root      4096 Mar 21 14:41 ../
-rw-r--r--  1 root         root         0 Mar 21 14:46 test.txt

過程中需要的 bucket name, access key id, 以及 access key secret 可以參考下面這幾張圖來找到。



Original link: Phanix's Blog

Like my work??
Don't forget to support or like, so I know you are with me..

CC BY-NC-ND 2.0

Want to read more ?

Login with one click and join the most diverse creator community.