I came across this interesting utility to sync backup files to Amazon S3. With this utility in less than ten minutes I learned how easy it is to upload a local file to remote folder in S3 bucket.
I already had a script in place to backup the site's files and database dump. To make this script complete I needed a script/ utility to sync backup files. And s3cmd came there as a savior. I would like to share in this blog post how easy it was to install, configure and get started to make the potential use of the same.
Our servers are running Ubuntu 12.04.1 LTS. Luckily this s3cmd package is available in Ubuntu's official repository. In no time, I got this installed in our machine with apt-get command.
The following command did the trick of installing,
This command would prompt to install a dependency package python-support. Once the installation is done it can be validated with the below command,
The output returned might be as below,
Essentially it looks for the presence of config file in home folder .s3cfg. In our case this is not in place, since this is the first time the utility is being used.
As suggested we need to create one by issuing the same command again with --configure argument.
This will ask for a series of questions. Essentially Access Key, Secret Key and other optional settings like proxy, choice of protocol (http vs https), etc.
When all the needful inputs are given, the utility smartly prompts to make a test before saving it to configuration file.
I found this tiny feature very handy. I noticed that the Security key I had entered in the first attempt was wrong :-(
Finally to achieve the intended goal, that is to sync the needed file to S3, I used the following command,
Interactive output of the command is below,