Souji Thenria

Create Backups Using Kopia and S3 Buckets

Summary: Create backups using Kopia and S3 compatible storage endpoints.

Created on:

-----

Some years ago, I wrote about creating backups using Kopia and Hetzner StorageBoxes; you can find that post here. Since then, I have played a bit with S3 compatible storage systems. There are some use cases where they are actually pretty awesome, and one of those is backups.

For that reason, I have written this short tutorial on how to use Kopia with S3. I would also like to note that Kopia’s own documentation is quite good, and this tutorial mainly serves as a reminder for myself so that I do not need to look everything up again.

General Configuration

The general Kopia configuration is quite straight forward, and includes all the typical configuration for services using S3 endpoints.

kopia repository create s3 \
        --bucket=<bucket-name> \
        --access-key=<acc-key> \
        --secret-access-key=<sec-key> \
        --no-check-for-updates \
        --description=<some description> \
        --endpoint=<hostname> \
        --region=<region-name>

HTTP Endpoints

In case you want to use an S3 bucket that is not accessible via HTTPS (for example, because it is only available on your local network and does not yet have a certificate), you can add the flag --disable-tls to use HTTP instead.

Ransomware Protection

When using the S3 backend with Kopia, you can take advantage of the S3 Object Lock feature, to prevents backups from being tampered with or deleted before a predefined point in time.

I will write more about this configuration once I have set it up. (Hopefully pretty soon.)

Additional Offsite Backup

Another nice advantage is that you can quite easily create additional off-site backups. For example, if you store your backups on your home server, you can simply copy a bucket containing backups to another S3 provider’s cold storage.

However, in case you already store your backups with another S3 provider, you need to watch out, because they often charge (sometimes quite a lot) for downloading data from buckets hosted on their platform.

Tags: