This tutorial will show you how to use rclone to back up your data to Amazon S3. Please note that you will need a valid Amazon / AWS account for this to work. In addition, AWS will charge you based on the amount of storage you use.

Install Rclone on instance

rclone is a command line program to sync files and directories to and from cloud storage.

Quickstart Installation

Installation by using a script

Install rclone on Linux/macOS/BSD systems:

curl | sudo bash

Configure rclone

After installing Rclone:

  1. Type rclone config 

  2. Type n for a New remote

  3. Give a name to your remote (AWS in this example)

  4. Select the type of storage to configure

         5. Choose the S3 provider

       6. Select the type of authentication method.       

PLEASE NOTE:  Enter your secret AWSAccesskeyId and AWSSecretKey in case you selected false.

     7. Select the region to connect( Canada-Central Region in this example).

      8. Select the Endpoint and Location constraint values.

      9. Select the Type of Access Control and encrypt

     10. Select the Redundancy type and verify all the remote config values

           before closing the rclone.

Create a S3 bucket using Rclone

Run the following command:

$ rclone mkdir <remote name>:<bucket name>

AWS S3 bucket names must be globally unique. It helps to create a bucket name using a unique name. For example, instead of calling a bucket "mysql_backups", call it "jdoe777_mysql_backups".

Once the remote is configured and the bucket is created you can use below commands to list the remotes and buckets:

$ rclone listremotes
$ rclone lsd <remote name>:

Synching/Copying using rclone

Run the below command to sync your data to your AWS bucket:

$ sudo rclone sync /path/to/local/data  <remote name>:<bucket name>

For example:

$ sudo rclone sync /var/lib/mysql  aws:mysql_backups

rclone Copy 

To copy files from source to destination and skipping files that have already been copied:

$ rclone copy /path/to/local/data <remote name>:<bucket name>