【问题标题】:How to automatically mount S3 bucket right after connecting to EC2 instances如何在连接到 EC2 实例后立即自动挂载 S3 存储桶
【发布时间】:2017-06-25 11:11:21
【问题描述】:
通常每次我连接(start 或 restart)我的实例时,我都必须手动
将 S3 存储桶安装到它。我使用Goofys(或s3fs)使用以下命令来完成
ubuntu@ip-172-00-23-230:~$ ./go/bin/goofys mybucket my_mountdir
是否可以在每次登录实例时自动挂载它
【问题讨论】:
标签:
amazon-web-services
amazon-s3
amazon-ec2
s3fs
goofys
【解决方案1】:
在 /etc/init.d/mountbucket 中创建一个新脚本
sudo vi /etc/init.d/mountbucket
写下你要执行的行:-
#!/bin/sh
/home/ubuntu/go/bin/goofys mybucket my_mountdir
使其可执行
sudo chmod ugo+x /etc/init.d/mountbucket
在每次系统重启时更新开始
sudo update-rc.d mountbucket defaults
【解决方案3】:
goofys 的 README 解决了这个用例:https://github.com/kahing/goofys/
简而言之:
要在启动时挂载 S3 存储桶,请确保凭据是
为 root 配置,并且可以将其添加到 /etc/fstab:
goofys#bucket /mnt/mountpoint fuse _netdev,allow_other,--file-mode=0666 0 0