Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

https://pypip.in/v/s3-backups/badge.png Build Status

Overview

S3 Backups provides easy scripts that system administrators can use to backup data from programs likes PostgreSQL, MySQL, Redis, etc.

Installation

To install s3-backups:

$ sudo pip install s3-backups

Usage

Setting Up S3 Backups to Run Automatically Using Cron

PostgreSQL

Add the following to the file /etc/cron.d/postgres_to_s3 and then change the command arguments so the command is using your correct AWS credentials, backup bucket and the correct base S3 Key/base folder.

0 */1 * * * postgres /usr/local/bin/postgres_to_s3.py --AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' --AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' --S3_BUCKET_NAME='my-backup-bucket' --S3_KEY_NAME='postgres/my-awesome-server' --backup --archive

Redis

Add the following to the file /etc/cron.d/redis_to_s3 and then change the command arguments so the command is using your correct AWS credentials, backup bucket and the correct base S3 Key/base folder.

0 */1 * * * root redis_to_s3.py --AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' --AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' --S3_BUCKET_NAME='my-backup-bucket' --S3_KEY_NAME='redis/my-awesome-server' --backup --archive

MySQL

Add the following to the file /etc/cron.d/mysql_to_s3 and then change the command arguments so the command is using your correct AWS credentials, backup bucket and the correct base S3 Key/base folder.

0 */1 * * * root mysql_to_s3.py --AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' --AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' --S3_BUCKET_NAME='my-backup-bucket' --S3_KEY_NAME='redis/my-awesome-server' --backup --archive

Manually Running Backups and Archiving

When running the archive command, S3 Backups moves backups into a year/month sub folder (technically a S3 key) for archives it’s scheduled to keep and removes all other archives. S3 Backups, will use the default schedule unless you you tell it to use a different schedule with the --schedule_module argument.

The default archive schedule will …

  • keep all archives for 7 days

  • keep midnight backups for every other day for 30 days

  • keep the first day of the month forever

  • remove all other files that aren’t scheduled to be kept

To backup PostgreSQL, run the following:

$ postgres_to_s3.py \
--AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' \
--AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' \
--S3_BUCKET_NAME='my-backup-bucket' \
--S3_KEY_NAME='postgres/my-awesome-server' \
--backup

To archive PostgreSQL backups, run the following:

$ postgres_to_s3.py \
--AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' \
--AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' \
--S3_BUCKET_NAME='my-backup-bucket' \
--S3_KEY_NAME='postgres/my-awesome-server' \
--archive

To backup Redis, run the following:

$ redis_to_s3.py \
--AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' \
--AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' \
--S3_BUCKET_NAME='my-backup-bucket' \
--S3_KEY_NAME='redis/my-awesome-server' --backup

To archive Redis, run the following:

$ redis_to_s3.py \
--AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' \
--AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' \
--S3_BUCKET_NAME='my-backup-bucket' \
--S3_KEY_NAME='redis/my-awesome-server' --archive

To backup MySQL, run the following:

$ mysql_to_s3.py \
--AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' \
--AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' \
--S3_BUCKET_NAME='my-backup-bucket' \
--S3_KEY_NAME='redis/my-awesome-server' --backup

To archive MySQL, run the following:

$ mysql_to_s3.py \
--AWS_ACCESS_KEY_ID='xxxxxxxxxxxxxxxxxxxx' \
--AWS_SECRET_ACCESS_KEY='xxxxxxxxxxxxxxxxxxxx' \
--S3_BUCKET_NAME='my-backup-bucket' \
--S3_KEY_NAME='redis/my-awesome-server' --archive

Contribute

If you’d like to contribute, create an issue to get a dialog going about the feature you want to add. After a plan is place then fork the repository and create your fix or feature on a new branch. When your finished, make a pull request to get your changes pulled in.

Release files for s3-backups 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for s3-backups 0.1.0
File Size Uploaded
s3-backups-0.1.0.tar.gz 7.8 kB Details

Release files / s3-backups-0.1.0.tar.gz

Download URL s3-backups-0.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e0bca1da60245635ae2a19c1810021e6587f7e34eb9ffec42f1e78b509e3919f
BLAKE2b-256 checksum
How to use checksums
2b8bb2988b537cad1bfb45cc1fd71032d6b395b218e117a33124794b37eb77b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page