Sign In
Sign In

Backing Up to S3 with Duplicity

Updated on 22 November 2024

Duplicity is a command-line utility for backup and recovery. Backups can be uploaded to storage using protocols such as SCP, SFTP, WebDAV, S3, Swift, and others. By default, the utility encrypts backups using GnuPG.

Below is an example of setting up Duplicity for backing up data to Hostman object storage using the Swift protocol.

  1. Create a separate bucket for backups.

  2. Install the duplicity package on the server along with the required dependencies.

    • For Duplicity versions below 0.8.x (which use Python 2), you need the python-swiftclient package.

    • For Duplicity version 0.8.x and above, install python3-swiftclient.

Use the following commands:

sudo apt-get install duplicity
sudo apt-get install python3-swiftclient
  1. Create a file named backup.sh with the following content, replacing the variable values with your actual credentials. You can find them in the Swift parameters section in your bucket Settings.

#!/usr/bin/env bash

export SWIFT_PASSWORD="storage_password"
export SWIFT_AUTHVERSION=2
export SWIFT_TENANTNAME="account_login"
export SWIFT_USERNAME="account_login"
export SWIFT_AUTHURL="URL"
export PASSPHRASE="encryption_password"

source=/home  # Path to the directory to be backed up
dest=bucket_name  # Destination bucket for backups

duplicity "$source" swift://"$dest"
  1. Run the following command to make the script executable:

chmod +x backup.sh
  1. Execute the script with the following command:

./backup.sh

 

Was this page helpful?
Updated on 22 November 2024

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start.
Email us
Hostman's Support