Table of Contents

s3cmd

Amazon S3 Sync

A simple way to keep local archives and an Amazon bucket up to date is to sync the two locations.

Here's a command that would take all the MySQL archives in /var/archives/mysql and sync them with the Amazon bucket, deleting any remote files that are no longer on the filesystem:

s3cmd --delete-removed sync /var/archives/mysql/ s3://steve-backups/mysql/

Examples

List all the files on a bucket
s3cmd ls s3://steve-bucket/ | sed 's/.* //g'
Find archives that are 2 months old
s3cmd ls s3://steve-bucket/ | sed 's/.* //g' | egrep "`date --date "-2 months" +%Y%m`[0-9]{2}"