Backing up with Restic

Posted: 09 Jun 2022. Last modified on 09-Jun-22.

This article will take about 1 minute to read.


Why

What is Restic

How to set up AWS bucket

How to set up Restic with your AWS bucket

Listing all snapshots

restic -r s3:s3.amazonaws.com/my-bucket snapshots

Getting the list of snapshot names

./do-list-snapshots.sh |\
  grep ':'             |\
  rev                  |\
  cut -d' ' -f 1       |\
  rev                  |\
  sort                 |\
  uniq

Restoring a snapshot

#!/bin/bash

if [ $# -ne 2 ]; then
    echo FAIL: requires 2 arguments
    echo - snapshot name
    echo - destination path
    exit 1
fi

restic \
    -r s3:s3.amazonaws.com/my-bucket \
    restore latest \
    --path "$1" \
    --target "$2"