Sync your aws important file with s3 bucket in a simple way

Let us assume your databse storage folder is /var/lib/mongo ,which wants to keep daily sync using s3 bucket in order to recover the data due to unexpected server failure

-First do SSH login to the AWS ec2 instance and then do the follwing confuguration setup.

# aws configure
AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxx //Your AWS Key
AWS Secret Access Key [None]: yyyyyyyyyyyyyyyyyyyyyyyy //Your Secret Key
Default region name [None]: us-east-1
Default output format [None]: ENTER


then please enter the following command

aws s3 sync /var/lib/mongo  s3://YourBucketName/database/


if u want to setup daily sync then just go to crontab and add the above command with the prefer time .