Digital Ocean spaces vs restic

Very easy answer to a problem that's probably had you cursing for ages. When you set up a DO Spaces instance, you get a URL like https://myspace.eur3.digitaloceanspaces.com/, where eur3 is the datacenter you're in and myspace is the space name you supplied.

So you just take that and append s3: to it in your restic config, don't you? Of course you do. Except you don't. That will just give you a weird client.BucketExists error.

So what it actually wants is this:

s3:eur3.digitaloceanspaces.com/myspace/

Or if you have created a subfolder, then use

s3:eur3.digitaloceanspaces.com/myspace/subfolder

If you're scripting this and using environment variables, your whole thing will look like this:

# Digital Ocean API Key
export AWS_ACCESS_KEY_ID=THESHORTCAPSANDNUMBERSTRING
# Digital Ocean API SECRET
export AWS_SECRET_ACCESS_KEY=Th3LongMix3dC4seString123213jkadfadsfasdadf
export RESTIC_REPOSITORY="s3:eur3.digitaloceanspaces.com/myspace/subfolder"
export RESTIC_PASSWORD="SecretEncryptionPW"

I hope this saved you some time, because I just spent a couple of hours trying to figure it out.

Leave a Comment