Managing Amazon S3 Online Storage with S3sync

1 11 2009

After trying to use Amazon’s S3 web service to backup files and to get a reliable download area for R functions and stuff which is not allowed to be uploaded to wordpress.com I ended up with some experimental “buckets” (= S3 online directory) and some 100 MB of files in them.

It turned out that it is not possible to delete a non-empty bucket from S3, so one is to required to recurse into the directories and delete all files one by one!

Eric Cheng and other blogs appearing after a google search pointed out S3sync as a suitable tool to remove a non-empty bucket.

So first one has to get Ruby and then also the OpenSSL interface for Ruby: sudo aptitude install ruby libopenssl-ruby

Then download s3sync (to your /home/yourself folder in this case) and unpack it: cd $HOME/
wget http://s3.amazonaws.com/ServEdge_pub/s3sync/s3sync.tar.gz tar xvzf s3sync.tar.gz
rm s3sync.tar.gz

This creates a s3sync folder containing the ruby code.

The package ca-certificates includes PEM files of CA certificates to allow SSL-based applications to check for the authenticity of SSL connections. It is needed to have the S3 connection secure via SSL and part of the default Ubuntu installation (at least included in my Xubuntu Karmic Koala. If not: sudo aptitude install ca-certificates

Before using s3sync get your access key and secret access key from Amazon. It has to be included in a file “s3config.yml” which is located in your home folder inside the directory “.s3conf” which has to be created. So:

mkdir $HOME/.s3conf
to create the directory.

Open your favorite text editor and create a plain textfile called s3config.yml inside the “.s3conf” folder which contains: aws_access_key_id: YourS3AccessKeyFromAmazon
aws_secret_access_key: YourS3SecretAccessKeyFromAmazon
SSL_CERT_DIR: /etc/ssl/certs

Prevent others from reading the configuration file containing your confidential access codes by chmod 700 $HOME/.s3conf/s3config.yml

Now you can start to use s3sync and s3cmd to manipulate your S3 storage space with e.g.: ruby $HOME/s3cmd.rb listbuckets

This was the first time I managed to manipulate successfully my S3 account. Ok, Djungledisk under Mac OS-X worked, but it is proprietary, though not expensive.

John Eberly’s blog was an inspiration to get started. Follow the link to his excellent blog post.





cwRsync – Transparent Backups in Windows XP

23 07 2009

The Unix tool rsync turned out to be a fast and reliable way to backup my /home folder to an USB-disk.

ITeF!x provides this installation-how2. He seems to maintain the packages. The website is quite informative, though a bit confusing to me. The download link did not work today,   so I found another download location.

Installation

Supported platforms: Client – Windows 9x/NT/2000/XP/2003, Server – NT/2000/XP/2003.

[Download cwRsync.] cwRsync comes as a zip archive containing a Nullsoft Installer package. Unzip downloaded file and run cwRsync_x.x.x_Installer.exe or cwRsync_Server_x.x.x_Installer.exe (server version) :

  1. Click Next at Welcome-page
  2. View license agreement.
  3. Select components that varies depending on package type: Client package has an optional component (Secure Channel Wrapper & Wizard). It makes creation of secure channels to cwrsync servers an easy task.
  4. Specify an installation location.
  5. (cwRsyncServer only) Specify a service account.
  6. Installation starts. By clicking ‘Details’ button, you can get more detailed information about installation. Check if everything seems ok.

You’re DONE! cwRsync is installed on your machine.

Rsync’ing a USB-disk with a Windows XP folder

Use your text-editor-of-choice and paste the following line into it:
rsync -au --exclude '.*' --exclude 'Music/' "/cygdrive/e/" "/cygdrive/h/DATA/home/"

My USB-drive showed up in the windows explorer as E:/ therfore it says /cygdrive/e/. The Windows folder was H:/DATA/home/ which translates into /cygdrive/h/DATA/home/. Change the paths to your specific situation.

Save the file as syncUSB.bat. The .bat tells Windows to execute the script in the commandline.

A variation of the script is
cwRsync\bin\rsync -au --exclude '.*' --exclude 'Music/' "/cygdrive/e/" "/cygdrive/h/DATA/home/"
when both the syncUSB.bat and the installation folder of cwRsync are in the folder which gets updated from the USB-disk.





Reinstalling Applications after a Fresh Install

20 07 2009

Once a while I am tempted to upgrade my OS or try another flavor. Now I started trying them on cheap 8-16GB USB-disks so I do not need to mess up my working system anymore…

The problem always is, that after using an OS for some month a lot of applications were installed and configuered. This took a lot of time. It is always a lot of work to get them all in place again and often I forgot about them, until I needed them. Preferably in a situtation without internet connection, so no way “sudo aptitude install” …

I was already up and going to create a script, manually punching everything which I found necessary , but then I found a preconfigured solution.

According to the great Ubuntu Guide:

If you upgrade your Ubuntu system with a fresh install, it is possible to mark the packages and services installed on your old system (prior to the upgrade) and save the settings (“markings”) into a file. Then install the new version of Ubuntu and allow the system to reinstall packages and services using the settings saved in the “markings” file. For instructions, see this Ubuntu forum thread. In brief:

  • On the old system: Synaptic Package Manager -> File -> Save Markings
  • Save the markings file to an external medium, such as USB drive.
  • Complete the backup of your system’s other important files (e.g. the /home directory) before the fresh install of the new system.
  • In the freshly installed new system, again open Synaptic Package Manager -> File -> Read markings and load the file on your USB drive (or other external storage) previously saved.

Note: Many packages, dependencies, and compatibilities change between version of Ubuntu, so this method does not always work. Automated updates remains the recommended method.





Manage Amazon S3 Buckets

6 07 2009

Yeah, delight!

I was using crappy development scripts to fiddle with S3 buckets on Amazon Web Services (AWS). Creating, listing, deleting buckets and so on was not that straightforward and I found it not well documented… have a growing suspicion that I am just not capable of web-searches…

OK, there is an easy way:
My.Bucket

A graphical user interface.

Unfortunately it refused to work with Ubuntu-Firefox, but did work in Windows XP-IE5.

Ok, another tool just found is the S3 manager add-on to Firefox. This finally turned out to be the easiest way to connect to Amazones Web Services and create an online storage (“bucket”), edit or delete them.