This tutorial helps you mount a DigitalOcean Spaces Bucket, and access it as how you normally access folders on Linux. Afterwards you could simply back up your bucket to another cloud storage provider.
The instructions will pretty much work for other S3-compatible storage providers and of course, S3 as well (just some substitutions will be needed).
Note #1: This tutorial assumes that you have a DigitalOcean Spaces bucket, and a Linux server/droplet.
Note #2: If you already have the access & secret keys of your bucket, skip to Step 4.
Step 1
From the Spaces tab on DigitalOcean, click “Manage Keys”
Step 2
Now click “Generate New Key” from the “Tokens/Keys” tab as shown below:
Step 3
Set a name for your key, then copy the resulting values highlighted below (the ACCESS_KEY_ID
and the SECRET_ACCESS_KEY
respectively):
Step 4
On your Linux machine, install the tool s3fs-fuse (Ubuntu example below):
$ sudo apt install s3fs
Step 5
Use the following command to install your DigitalOcean Spaces key on your machine:
$ echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs && chmod 600 ${HOME}/.passwd-s3fs
In this example, using the values in Step 3, replace ACCESS_KEY_ID:SECRET_ACCESS_KEY
by LBIQ652YZFSGJWKWXFKR:XXgVybv8x7Sphgx+42pZtaT5qRrCrseiCCtopagXouo
Step 6
Create the folder where you want to access your bucket:
$ mkdir -p /media/my-local-bucket
Step 7
Now we just need to mount the bucket on the chosen folder using this single command:
$ s3fs my-awesome-space /media/my-local-bucket \
-o passwd_file=${HOME}/.passwd-s3fs \
-o url=https://nyc3.digitaloceanspaces.com/ \
-o use_path_request_style
This command mounts our DigitalOcean Spaces bucket named my-awesome-space
on the folder /media/my-local-bucket
in Linux.
Note: in our example, the bucket is located in nyc3
region. If your bucket is in another region, make sure you replace nyc3
by the correct region.
You can find the region and the bucket name as shown below:
(We support all DigitalOcean Regions)
Verify That It Works
Finally, you can check the local folder /media/my-local-bucket
to verify that it has your DigitalOcean Spaces bucket files and folders! 👏
$ ls -lah /media/my-local-bucket
Step 8 — Confirmation
In the screenshot above, we locally see the same files and folders seen earlier in Step 7 — this verifies that we can access the bucket as a local folder.
If you are still unable to make it work
Repeat the steps and make sure you set the right Bucket region / name
Reach out to us by chat and we will help!