The current Ubuntu version on AWS EC2 instances is 18.04 LTS. After launch an Ubuntu Instance and connect to it by SSH, one can follow those steps to set up a permanent mount to S3 bucket.
- Install the packages.
$ sudo apt update $ sudo apt-get install s3fs
- Create a global access key password file. The access key can be created in IAM console, following those guidelines.
$ echo "0ASDF87XJKN34LK32EXAMPLE:AklasjlUUHNJ98SaadASKEXAMPLE1237890" | sudo tee /etc/passwd-s3fs $ sudo chmod 600 /etc/passwd-s3fs
- As a test, we could first mount it manually in command line.
$ sudo s3fs myBucket /path/to/mount/point $ sudo ls /path/to/mount/point # List of files and folders
part. If everything works well, we can un-mount the bucket and prepare for the auto-mount steps.
is the name of the bucket, exclude
$ sudo fusermount -u /path/to/mount/point
- To set up the auto-mount at booting. We first add a line into
s3fs#myBucket /path/to/mount/point fuse _netdev,allow_other,umask=0007,uid=1000 0 0
is the user's id. It could be found by
$ id -u
Now we can reboot the instance, the S3 bucket will be mount automatically. Alternatively, we can test the auto-mount without reboot.
$ sudo mount -a