How to upload mysql dump to s3 bucket

How to upload mysql dump to s3 bucket

#/bin/bash
DATE=$(date +%H-%M-%S)
BACKUP=db-$DATE.sql
DB_HOST=$1
DB_PASSWORD=$2
DB_NAME=$3
AWS_SECRET=$4
BUCKET_NAME=$5
mysqldump -u root -h $DB_HOST -p$DB_PASSWORD $DB_NAME > /tmp/$BACKUP && \
export AWS_ACCESS_KEY_ID=ACCESS_KEY_HERE && \
export AWS_SECRET_ACCESS_KEY=SECRET_KEY_HERE && \
echo "Uploading your $BACKUP backup" && \

aws s3 cp /tmp/db-$DATE.sql s3://$BUCKET_NAME/$BACKUP

Share on Google Plus

About Md. Shahzad Alam

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