Skip to content

Automatic backups to AWS S3 with Borg. Under development.

Notifications You must be signed in to change notification settings

abendy/macos-to-s3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backup macOS to S3

Install

Clone this repository, install virtualenv, init a virtual env and activate it

git clone [email protected]:abendy/macos-to-s3.git
cd macos-to-s3

python3 -m pip install --user virtualenv
virtualenv venv
. venv/bin/activate

pip3 install -r requirements.txt

Create directories for cache and security

mkdir -p /usr/local/var/lib/borg/{cache,security}

Key

mkdir -p keys

sudo ssh-keygen -t ed25519 -C "Borg" -f keys/id_ed25519

sudo chmod 0600 keys/*
sudo chmod 0644 keys/*.pub

Config

Includes & excludes

cp etc/backup.includes.sample etc/backup.includes
vi etc/backup.includes

cp etc/backup.excludes.sample etc/backup.excludes
vi etc/backup.excludes

Environment variables

cp .env.sample .env
vi .env

You could source this from your shell run commands config

source <path_to>/.env

Setup GPG and Password Store

brew cask install gpg-suite
brew install pass

pass init <gpg_id>
pass generate borg
pass show borg

Configure AWS CLI with some admin credentials

aws configure

Create an AWS user and group w/ S3 access

aws iam create-group --group-name <group_name>

aws iam attach-group-policy --group-name <group_name> --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess

aws iam add-user-to-group --group-name <group_name> --user-name <user_name>

aws iam create-access-key --user-name <user_name>

Copy the access key and secret access key and fill out the .env file

Repo

Repository URLs

mkdir -p <repo_location>

sudo -E borg init --encryption=repokey-blake2 --storage-quota=<size>G <repo_location>

Backup

sudo -E ./borg-backup.sh

List all archives in the repository:

sudo -E borg list <repo_location>

sudo -E borg list <repo_location>::<archive_name>

Mount an archive

sudo -E borg mount <repo_location>::<archive_name> <extract_path>

Restore an archive

sudo -E borg extract <repo_location>::<archive_name>

Delete an archive

sudo -E borg delete <repo_location>::<archive_name>

Thanks

SES code

About

Automatic backups to AWS S3 with Borg. Under development.

Topics

Resources

Stars

Watchers

Forks

Languages