Tested on Amazon S3 with Amazon Linux 2023.
[Unit]
Description=Mountpoint for Amazon S3 mount
After=cloud-init.target
AssertPathIsDirectory=<mountpath>
[Service]
Type=forking
User=<username>
Group=<groupname>
ExecStart=/usr/bin/mount-s3 <bucketname> <mountpath>
ExecStop=/usr/bin/fusermount -u <mountpath>
[Install]
WantedBy=default.target
Please fill in the following variables:
<username>
: Get by executingwhoami
<groupname>
: Get by executingid -Gn $(whoami)
<bucketname>
: The name of your bucket<mountpath>
: The path you gonna mount the bucket, remember to create the directory before enabling this service by executingmkdir <mount path>
, such asmkdir ~/mnt
Be sure to install mouintpoint-s3. Then:
- Create the systemd service and placed it into
/etc/systemd/system/
, e.g.,/etc/systemd/system/mountpoint-s3.service
- Start the service to verify if it works:
systemctl start mountpoint-s3
- If it works, make it start automaticlly on startup:
systemctl enable mountpoint-s3
Also consider to modify the mount-s3
command in ExecStart
part if any additional option should be appended to it (e.g., /usr/bin/mount-s3 <bucket name> <mount path> --allow-delete
to allow delete action).
Enjoy!