1 / 7

How to Backup Website to Amazon S3

Sometimes you may need to backup website to Amazon S3. Here are the steps to do it.<br><br>Visit https://fedingo.com/how-to-backup-website-to-amazon-s3/

Download Presentation

How to Backup Website to Amazon S3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to Backup Website to Amazon S3

  2. Install AWSCLI AWSCLI is available in almost every default Linux repository. So you can easily install it with the following commands, depending on your Linux distribution. $ sudo dnf install awscli ## Fedora, Redhat and CentOS $ sudo apt install awscli ## Ubuntu, Debian and Linux Mint Run the following command to verify installation. $ aws --version

  3. Create Shell Script (1 of 2) Create following shell script #/usr/bin/env bash S3_BUCKET_NAME="" DIR_TO_BACKUP="/var/www/html" BACKUP_FILENAME='website' TODAY=`date +%Y%m%d` YY=`date +%Y` MM=`date +%m`

  4. Create Shell Script (2 of 2) AWSCMD="/usr/local/bin/aws" TARCMD="/usr/bin/tar" ${TARCMD} czf /tmp/${BACKUP_FILENAME}-${TODAY}.tar.gz ${AWSCMD} cp /tmp/${BACKUP_FILENAME}-${TODAY}.tar.gz s3://${S3_BUCKET_NAME}/${YY}/${MM}/ if [ $? -eq 0 ]; then echo "Backup successfully uploaded to s3 bucket" else echo "Error in s3 backup" fi

  5. Make Shell Script Executable Run the following command to make shell script executable. $ chmod +x /scripts/website_backup.sh Now you can run the script with the following command. $ bash /scripts/website_backup.sh

  6. Create Cronjob Open Crontab with the following command. $ crontab -e Add the following entry to your crontab to run website_backup.sh script every day at 10 a.m. 0 10 * * * bash /scripts/website_backup.sh

  7. Thank You Visit for details https://fedingo.com/how-to-backup-website-to-amazon-s3/

More Related