If you’re storing anything in MySQL databases that you do not want to lose, it is very important to make regular backups of your data protect it from loss.
In this tutorial, we will provide you bash script which automates your MySQL database backups on daily,weekly or as per your requirement basis.
sometimes storing your backups on the same server is also risky because if the same server exhaust then with you original data you loose backup as well.
for this kind of situation we need to store this backup files somewhere else which give a guarantee of your data. Here we are going to use AWS S3 bucket service to store our daily data backups.
I hope you have aware of S3 service and you have s3 bucket and credentials which we need to configure on the server. If you do not create s3 bucket then refer below link
Once you have done with S3 bucket configuration, follow below provided steps to configure MySQL database backup script on the server.
Step 1 : Install s3cmd Command
To transfer or copy a file from the server to S3 bucket we need an s3cmd command to be installed on the server. for installing s3 command use below apt-get command.