Shell Script upload mysql backup to S3 bucket

 #!/bin/bash
DATE=$(date +%d-%m-%Y)
DB_HOST=localhost
DB_PASSWORD=pass@123
DB_NAME=mydb

mysqldump -u root -p$DB_PASSWORD -h $DB_HOST $DB_NAME > /dbbackup/db-$DATE.sql
export AWS_ACCESS_KEY_ID=ACCESS_KEY_HERE
export AWS_SECRET_KEY=SECRET_KEY_HERE

echo "Uploading db backup"
s3 cp /dbbackup/db-$DATE.sql s3://mybucket/db-$DATE.sql

 

 

Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment