Having a copy of your data is a peace of mind! Let’s focus here on how to back up your computer to a S3 bucket at (almost) no cost with an open source solutions: Restic (and Autorestic).

Backup your computer to S3

1. Presentation of (Auto)Restic

Restic is a cross-platform tool that backs up your files to different storage types, including online services such as S3 storages. Having some computer knowledge is required, so this technique is not available to everyone. However, the setup complexity is decent, especially if you use Autorestic.

Autorestic is a wrapper around Restic to simplify the setup and cron job part. It’s not required, but definitely appreciated.

Advantages of using such a method:

  • You only pay for the external storage you use.
  • It’s efficient and customizable.
  • You choose your S3 provider.
  • You can additionaly back up the data to an external drive at no cost.

2. The S3 provider

Choose your provider

First and foremost, you have to decide where you data is going to be stored.

At least three criteria you could consider:

  • Price (storage and bandwidth)
  • Stability
  • Ethics and regulations

Whatever provider you choose, as long it follows S3 specs, you should be good to go.

I chose to host my data at Scaleway, where I currently work.

The pricing is quite honest, neither the highest nor the cheapest. Let’s say you have 100 GB of data to back up:

  • storage: 1,46€ / month, or 17,52€ / year
  • transfer: 75gb free (each month), and then 0,01€ / Go

Of course, it might not be worth for non-sensitive data. Or maybe you would be better just saving to an external drive or NAS. It’s up to you to decide if having an additional backup in a remote location is worth the money.

Create a bucket

At this point, you should create an account with the provider you have chosen, create a bucket, and create an access and secret token (ideally, scoped to this storage project) allowing you access to it. It means you have in your possession:

  • An access token
  • A secret token
  • The URL of your bucket (including the region and the bucket name)

3. Install and setup

The installation depends on your OS. If you have a Mac, you could use Homebrew as package manager and run brew install restic autorestic; else, please refer to their documentation.

Write the configuration file

Let’s get to the point, and directly create the configuration file for autorestic called .autorestic.yml located in your home directory (so at ~/.autorestic.yml on Mac).

Here, I plan to save two folders in one S3:

  • My ~/Documents folder where I keep the important stuff.
  • My Notes app folder (in case iCloud issues).
version: 2
    from: '~/Documents'
    to: remote
    cron: '0 9,15,18 * * *'
    from: '~/Library/Group Containers/group.com.apple.notes'
    to: remote
    cron: '0 9,15,18 * * *'

    type: 's3'
    path: 's3.fr-par.scw.cloud/my-backup-name'
    key: 'your-encryption-key-do-not-lose-it'
      AWS_SECRET_ACCESS_KEY: '0c2ee052-163f-4017-9a70-c05d8abdb2df'


  • The locations are places that you want to back up. The backends are places where the backup will be achieved.
  • The S3 path should include the bucket name at the end, and NOT as a subdomain.
  • You could move the secrets out of this file, either in a environment file, or in environment variables.

Initialize the S3 bucket

The configuration file has been edited to your needs and is at the proper location? GOOD.

But the S3 bucket should still be empty at this point. Launching a backup won’t work at the moment, it requires a one-time initialization:

autorestic exec -a init
  • The exec command launches the restic exec.
  • The -a option tells autorestic to apply the command for all the backends.
  • The init command tells restic exec to initialize your backend.

If everything went fine, check the content of your S3 bucket, it shouldn’t be empty anymore.

If so, launch your first backup with the following command:

autorestic backup -a
  • The backup command speaks for itself.
  • The -a option tells autorestic to apply the command for all the backends.

Then you just wait! It shouldn’t be that long, except if you have terabytes or data.

Setup a cronjob

Finally, we have to setup a cronjob so Autorestic will launch the backup at the proper time.

For that, just open your jobs with crontab -e, and add a new line:

*/15 * * * * /opt/homebrew/bin/autorestic -c ~/.autorestic.yml --ci cron >> /tmp/autorestic.log 2>&1
  • /opt/homebrew/bin/autorestic defines the path to the autorestic binary, change it if you didn’t use Homebrew.
  • >> /tmp/autorestic.log 2>&1 appends the logs into a file, useful to debug!
  • Change the cronjob to something that fits your needs. So */5 would be fine to debug.
    • The regex should be consistent with what your .autorestic.yml contains.

Restore a backup

Let’s hope you won’t need to restore files anytime soon! But just in case, let’s learn how to restore all the files from a bucket (consider the transfer pricing before doing so!).

The command line is straighforward:

autorestic restore --location notes --to ~/Desktop/my-saved-notes
  • The restore command speaks for itself.
  • The --location notes option specifies the location we want to restore.
  • The --to ~/Desktop/my-saved-notes option specifies the path to restore the data.

You can also restore a specific snapshot (i.e. not just the latest one). First, you need to list the snapshots:

autorestic --verbose exec -a snapshots
  • The --verbose is mandatory for an obvious reason (bug?), else the snapshots don’t display.

You should have a table similar to this one:

ID        Time                 Host                        Tags                   Paths
e7adac5d  2023-11-12 20:07:51  Vincents-MacBook-Pro.local  ar:location:documents  /Users/vincent/Documents
4739fe0f  2023-11-18 15:00:17  Vincents-MacBook-Pro.local  ar:location:documents  /Users/vincent/Documents
b505093d  2023-11-18 15:00:30  Vincents-MacBook-Pro.local  ar:location:notes      /Users/vincent/Library/Group Containers/group.com.apple.notes
774920ec  2023-11-18 15:00:49  Vincents-MacBook-Pro.local  ar:location:documents  /Users/vincent/Documents
dba74776  2023-11-29 16:03:40  Vincents-MacBook-Pro.local  ar:location:documents  /Users/vincent/Documents
626f31ed  2023-11-29 16:03:48  Vincents-MacBook-Pro.local  ar:location:notes      /Users/vincent/Library/Group Containers/group.com.apple.notes
e70fe2ee  2023-12-01 09:44:24  Vincents-MacBook-Pro.local  ar:location:documents  /Users/vincent/Documents
8a5a3711  2023-12-01 09:44:29  Vincents-MacBook-Pro.local  ar:location:notes      /Users/vincent/Library/Group Containers/group.com.apple.notes

Then, you can use the ID in the restore command:

autorestic restore 8a5a3711 --location notes --to ~/Desktop/my-saved-notes

4. Final words

Open source exists thanks to people contributing to it! So if (Auto)Restic has been helpful to you, consider eihter checking their GitHub projects to help, or donate if accepted.