How to take RDS MySQL Database backup and put it in Amazon s3 directly

por | 12 julio, 2023

You can also use STDOUT and the AWS CLI tool to pipe the output of your mysqldump straight to S3:

mysqldump -h [db_hostname] -u [db_user] -p[db_passwd] [databasename] | aws s3 cp - s3://[s3_bucketname]/[mysqldump_filename]

For example:

mysqldump -h localhost -u db_user -ppassword test-database | aws s3 cp - s3://database-mysqldump-bucket/test-database-dump.sql

The mysqldump command outputs to STDOUT by default. Using - as the input argument for aws s3 cp tells the AWS CLI tool to use STDIN for the input.

Categoría: aws