Skip to content

Tool to do backup of the selected directories and files on a server and send the resulting TAR file to AWS S3

License

Notifications You must be signed in to change notification settings

rubenmromero/files-s3-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Files-S3-Backup

Tool to do backup of the selected directories and files on a server and send the resulting TAR file to AWS S3.

Prerequisites

  • An IAM User or an AWS IAM Role attached to the EC2 instance (only for executions from EC2 instances) with the following IAM policy attached:

    Policy Name : AmazonS3FullAccess
    
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": "s3:*",
                "Resource": "*"
            }
        ]
    }
    
  • Pip tool for Python packages management. Installation:

    $ curl -O https://bootstrap.pypa.io/get-pip.py
    $ sudo python get-pip.py
    
  • AWS CLI to configure the profile to use (access key and/or region). Installation and configuration:

    $ sudo pip install awscli
    
    $ aws configure [--profile <profile-name>]
    AWS Access Key ID [None]: <access_key_id>         # Leave blank in EC2 instances with associated IAM Role
    AWS Secret Access Key [None]: <secret_access_key> # Leave blank in EC2 instances with associated IAM Role
    Default region name [None]: <region>              # eu-west-1, eu-central-1, us-east-1, ...
    Default output format [None]:
    

Configuration

  1. Clone the project in the path you want:

    $ git clone https://github.com/rubenmromero/files-s3-backup.git
    
  2. Create a copy of fs3backup.conf.dist template as conf/fs3backup.conf and set the backup properties with the appropriate values:

    # From the project root folder
    $ cp conf/fs3backup.conf.dist conf/fs3backup.conf
    $ vi conf/fs3backup.conf
    
  3. If you want to schedule the periodic tool execution, copy the files-s3-backup template to the /etc/cron.d directory and replace the existing <tags> by the appropriate values:

    # From the project root folder
    $ sudo cp cron.d/files-s3-backup /etc/cron.d
    $ sudo vi cron.d/files-s3-backup
    

Execution Method

Once set up the backup properties in the conf/fs3backup.conf file, simply run bin/fs3backup.sh script as follows:

# ./bin/fs3backup.sh

Related Links

About

Tool to do backup of the selected directories and files on a server and send the resulting TAR file to AWS S3

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages