0

I have S3 bucket "foo.backups", s3cmd is installed on my DigitalOcean droplet. I need to backup mydb.sqlite3 database and "myfolder".

How to make scheduled daily backups of these databse and folder with such structure:

s3://foo.backups/
-30jan15/
--mydb.sqlite3
--myfolder/
---...
-31jan15/
--mydb.sqlite3
--myfolder/
---...
-1feb15/
--mydb.sqlite3
--myfolder/
---...

How can I set it up?

Thanks!

NonGrate
  • 862
  • 9
  • 22

2 Answers2

1

As an alternative to s3cmd, aws-cli - you might consider using https://github.com/minio/mc

mc implements mc mirror command to recursively sync files and directories to multiple destinations in parallel.

Features a cool progress bar and session management for resumable copy/mirror operations.

$ mc mirror
NAME:
   mc mirror - Mirror folders recursively from a single source to many destinations.

USAGE:
   mc mirror SOURCE TARGET [TARGET...]

EXAMPLES:
   1. Mirror a bucket recursively from Minio cloud storage to a bucket on Amazon S3 cloud storage.
      $ mc mirror https://play.minio.io:9000/photos/2014 https://s3.amazonaws.com/backup-photos

   2. Mirror a local folder recursively to Minio cloud storage and Amazon S3 cloud storage.
      $ mc mirror backup/ https://play.minio.io:9000/archive https://s3.amazonaws.com/archive

   3. Mirror a bucket from aliased Amazon S3 cloud storage to multiple folders on Windows.
      $ mc mirror s3/documents/2014/ C:\backup\2014 C:\shared\volume\backup\2014

   4. Mirror a local folder of non english character recursively to Amazon s3 cloud storage and Minio cloud storage.
      $ mc mirror 本語/ s3/mylocaldocuments play/backup

   5. Mirror a local folder with space characters to Amazon s3 cloud storage
      $ mc mirror 'workdir/documents/Aug 2015' s3/miniocloud

Hope this helps.

Harshavardhana
  • 1,400
  • 8
  • 17
0

As an alternative to s3cmd, you might consider using the AWS Command-Line Interface (CLI).

The CLI has an aws s3 sync command that will copy directories and sub-directories to/from Amazon S3. You can also nominate which filetypes are included/excluded. It will only copies that a new or have been modified since the previous sync.

See: AWS CLI S3 documentation

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470