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.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

avoid_disaster-1.1-py2.6.egg (5.9 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for avoid_disaster-1.1.tar.gz
Algorithm Hash digest
SHA256 15a966075959a5af30d47f26aee985b98c2b443a25f74cea1943ac502c6f9929
MD5 8048a9641819851d4850296d87970e52
BLAKE2b-256 4d2fa6b7781fda8b41133215323fca4784280dd1fdec42696ae5eaf2c750f5d9

See more details on using hashes here.

Provenance

File details

Details for the file avoid_disaster-1.1-py2.6.egg.

File metadata

File hashes

Hashes for avoid_disaster-1.1-py2.6.egg
Algorithm Hash digest
SHA256 b8cce448d862b01dd245be44779f9a5f693a1e33d159d84eb8a2d6fdb55bd5a1
MD5 d043ef6b137a363d987de5d5b92dcbaa
BLAKE2b-256 bce90f6aa0f60fcf15b1e1a39b12c7804278450b2dd86bf56e51cd65a8406651

See more details on using hashes here.

Provenance

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