Amazon Glacier provides an extremely cost-effective cold-storage solution for archiving periodic server backups (such as weekly full-system and MySQL snapshots) without paying standard S3 active storage pricing. Here is how to configure automated Glacier uploads using the command-line utility glacier-cmd on cPanel and Virtualmin servers.
Components: Amazon Glacier Vault •
glacier-cmd Python CLI • Automated root cron backup workflow
1. Installing glacier-cmd
Install Python setup tools and the Glacier command-line interface:
yum install git python python-setuptools -y
cd /usr/src
# For cPanel servers, link git to system path if needed:
[ ! -f /usr/bin/git ] && ln -s /usr/local/cpanel/3rdparty/bin/git /usr/bin/git
git clone https://github.com/uskudnik/amazon-glacier-cmd-interface
cd amazon-glacier-cmd-interface
python setup.py install
2. Configuring AWS Credentials
Create ~/.glacier-cmd in the root home directory:
[aws]
access_key=YOUR_AWS_ACCESS_KEY_ID
secret_key=YOUR_AWS_SECRET_ACCESS_KEY
[glacier]
region=us-east-1
bookkeeping=True
bookkeeping-sqlite-db=/root/.glacier-cmd-db
3. Uploading Backups to a Vault
Create your backup vault and upload archives with automatic multipart chunking:
# Create a new vault
glacier-cmd mkvault server-backups
# Upload a backup archive with description
glacier-cmd upload --description "cPanel Weekly Full Backup $(date +%Y-%m-%d)" server-backups /backup/weekly-backup.tar.gz