Database backup on Amazon S3

I’ve forked a cool gist code, made by klangley here, to allow a more reasonable number of database backups using the Amazon S3 storage webservice.

My forked version is available here: and allows a rotating daily backup and a rotating weekly backup: in this way you’ll have 4-5 weekly backups (one for each week of the month) and 6 daily backups (one for each day of the week, excluding Sunday) for a total of 10-11 backups.

So if you have 1 GB of databases dumps (they are gzipped before putting them on S3) you’ll have 10-11 GB of S3 space used each month (against the 365 GB of the original klangley’s code at the end of the year). Naturally if you start with 10 GB of databases dumps you’ll save many many dollar$ ;)

For the paranoiac guys I’ve also added a monthly backup (it can be simply removed removing the rows with #PG at the end), and in this way you’ll have a 22-23 total backups: now we are in November, so what do you do with a Jan-Feb-Mar-Apr-May-(…) backup?

In order to use Disqus to comment out you have to accept the use of third-party cookies.