2

I successfully implement autofs to automatically mount s3 bucket to the server which running ubuntu server 14.04.5 by following this tutorials. but the number of bucket (that needs to automatically mounted) is dynamic, means its can be increase or decrease. so far I need to add/remove rule in autofs config whenever the bucket number changed.

the option command for mount those bucket is same. only path and bucket name that have difference. here is my configuration :
on /etc/auto.master

+auto.master
/- /etc/auto.s3bucket --timeout=30

on /etc/auto.s3bucket

[mount-point-bucket1] -fstype=fuse,uid,gid,etc,etc  :[tool-mounting]#bucket1
[mount-point-bucket2] -fstype=fuse,uid,gid,etc,etc  :[tool-mounting]#bucket2
.....
[mount-point-bucketX] -fstype=fuse,uid,gid,etc,etc  :[tool-mounting]#bucketX

my question : Is there a built-in script or function in autofs to dynamically add or remove rule in the file configuration?. so I don't need to re-config whenever the bucket is decrease or increase.

kahidna
  • 21
  • 4

3 Answers3

1

first check your S3 access:

s3fs your-s3-bucket /mnt -o passwd_file=/path/to/your/secrets

if this works, enter this into your autofs config:

s3 / -fstype=fuse,passwd_file=/path/to/your/secrets :s3fs\#your-s3-bucket
user250611
  • 11
  • 1
  • Thanks, I used your guide and did this for a non-amazon host: `s3fs publicdrive /home/mini/clould -o passwd_file=\`pwd\`/secret -o allow_other -o host=https://non-amazon-host` and it worked so nice – SdSaati Feb 11 '23 at 23:17
1

Old post, but needed some info on doing this so stumbled across this. I kept getting a syntax error using the answer previously proposed. I had to adjust my auto.master and add a url to my map file since our corp site is using on-prem AWS. I'll leave my notes here in case it helps anyone out.

auto.master

/-    /etc/auto.s3fs --timeout=30,--ghost

auto.s3fs

# note: mkdir /mnt/my_s3_bucket and chmod/own root 0600 /etc/s3fs/secrets
/mnt/my_s3_bucket/ -fstype=fuse,passwd_file=/etc/s3fs/secrets,url=https://s3.mycorp.com :s3fs\#my-s3-bucket
Server Fault
  • 547
  • 1
  • 4
  • 17
0

To dynamically mount a bucket set your /etc/auto.s3bucket to:

* -fstype=fuse,uid,gid,etc,etc :[tool-mounting]#&

Lee
  • 1