Skip to content

Instantly share code, notes, and snippets.

@olly
Created October 9, 2008 20:59
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save olly/15890 to your computer and use it in GitHub Desktop.
Save olly/15890 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Export some ENV variables so you don't have to type anything
export AWS_ACCESS_KEY_ID=<your-access-key-id>
export AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
export PASSPHRASE=<your-gpg-passphrase>
GPG_KEY=<your-gpg-key>
# The source of your backup
SOURCE=/
# The destination
# Note that the bucket need not exist
# but does need to be unique amongst all
# Amazon S3 users. So, choose wisely.
DEST=s3+http://51degrees_backup
duplicity \
incremental \
--full-if-older-than 1M \
--encrypt-key ${GPG_KEY} \
--sign-key ${GPG_KEY} \
--include=/etc \
--include=/home \
--include=/root \
--include=/srv \
--exclude=/** \
--volsize 250 \
${SOURCE} ${DEST}
duplicity remove-older-than 6M --force ${DEST}
# Reset the ENV variables. Don't need them sitting around
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export PASSPHRASE=
@alecloudenback
Copy link

Very helpful script! If I might suggest, after line 28, you could add the following:

 # --s3-use-rrs \

and allow users to comment/uncomment it out to disable/enable Reduced Redundancy Storage, if they so choose.

@saurabhnanda
Copy link

I'm following your script, but am unable to make duplicity write to a pre-existing S3 bucket. The bucket is empty, if that makes any difference.

@maxxer
Copy link

maxxer commented Dec 6, 2017

a little OT, but how can you estimate the costs of S3 storage with Duplicity? Other than the space itself, how much does the GET/PUT performed by the software weigh? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment