Backup setup to s3

From Origami_Wiki
Revision as of 12:17, 27 April 2021 by 137.97.105.157 (talk) (Backup setup to s3)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


1) Firstly create bucket and grant permission for a user to it by following the steps mentioned in the below documents

S3 bucket creation

S3 bucket access user creation

2) Login to the server in which we want to configure backup to s3 bucket

3) Then install awscli

yum install awscli

4) Then we need to configure the user with permission to the corresponding bucket in the server. For that run the command " aws configure"

5) It will ask for "Access key ID" and "Secret access key", which was obtained when we create the user with programmatic access. Please give it without any mistake.

6) Then configure the cronjob for moving the backup to the corresponding s3 bucket to which the user has access.

7) For setup the cron you can use below steps

  • ) Create a shell script using the below command
 #!/bin/bash
 aws s3 mv <Source directory> s3://<bucketname> --recursive
  • ) Give execution permission to the script
 chmod +x <filename.sh>
  • ) To open cron tab use the command >> crontab -e
  • ) Then configure cron job by the general syntax. One example is given below.
  30 20 * * * /home/user/filebackupmove.sh     ( it will execute at server time 8:30 pm every day )