Mysql – Upload database backup from thesql to Amazon S3 or Glacier without creating local file

amazon s3amazon-web-servicesbackupMySQLunix

Is there a tool that makes possible to backup a Mysql database to Amazon S3 or Amazon Glacier without having o create a local file with the database contents?

Something like that:

mysqldump -u root -ppass -h host –all-databases | magical-s3-tool s3-bucket backup-yyyy-mm-dd.sql

This magical tool would use the pipe data and transfer the backup data directly to S3, without creating a local file.

EDIT:

My goal is to avoid having to use a VM with a huge disk for running the backup process.

Best Answer

You can use this:

mysqldump \
    --host=127.0.0.1 --port=1234 \
    --user='username' --password='password' \
    --single-transaction --routines --triggers --compress --compact \
    --databases '<database name>' | gzip | aws s3 cp - s3://'<bucket name>'/'<database name>'.sql.gz