Skip to main content

Script backups easily to Amazon S3

Project description

avoid_disaster

Avoid Disaster can be used to script daily, weekly or monthly backups and upload them to S3.

For more information check out: http://amix.dk/blog/post/19529#Avoid-Disaster-Script-backups-easily-to-Amazon-S3

Examples

Example of creating a backups of test_dir/:

import os
from avoid_disaster import S3Uploader, gunzip_dir, generate_file_key

#--- Globals ----------------------------------------------
AWS_KEY = 'YOUR AWS KEY'
AWS_SECRET = 'YOUR AWS SECRET'

s3_uploader = S3Uploader(AWS_KEY,
                         AWS_SECRET,
                         'backups.your_domain.com')

#--- Easy usage ----------------------------------------------
#Daily
s3_uploader.compress_and_upload('test_dir/',
                                'test_dir.%(weekday)s.tgz',
                                replace_old=True)

#Monthly
s3_uploader.compress_and_upload('test_dir/',
                                'test_dir.%(month_name)s.tgz',
                                replace_old=True)

#Weekly
s3_uploader.compress_and_upload('test_dir/',
                                'test_dir.%(week_number)s.tgz',
                                replace_old=True)


#--- Generic usage ----------------------------------------------
file_key = generate_file_key('test_dir.%(weekday)s.tgz')
gz_filename = gunzip_dir('test_dir/', file_key)
s3_uploader.upload(file_key, gz_filename, replace_old=True)
os.remove(gz_filename)

Copyright: 2010 by amix License: BSD.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avoid_disaster-1.3.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

avoid_disaster-1.3-py2.7.egg (6.1 kB view details)

Uploaded Source

File details

Details for the file avoid_disaster-1.3.tar.gz.

File metadata

File hashes

Hashes for avoid_disaster-1.3.tar.gz
Algorithm Hash digest
SHA256 619a6e6db716614889d78f8b79d53fff1f8e2c41e7ed3a1c822cbe75b108bed9
MD5 b747de47e5264d55f2106967e7ce8abd
BLAKE2b-256 4457f480db418ab851214e8dd86b1dda8f3f4678a1491e04efea7a8f0b670416

See more details on using hashes here.

File details

Details for the file avoid_disaster-1.3-py2.7.egg.

File metadata

File hashes

Hashes for avoid_disaster-1.3-py2.7.egg
Algorithm Hash digest
SHA256 10c648c002524ab546c31d1b75d35f5b3458347c56040666db841d32a7528513
MD5 b88621b88af41634b137057c493c40e4
BLAKE2b-256 93ff83172584631daccb37dd57b3fa9f663d31cdca31e662934d727876ac989d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page