A couple of months ago I started to use Amazon S3 (Amazon Simple Storage Service) as off site backup for one of my servers. It’s dirt cheap and so far it works very well (I’m paying less than $1 per month for my daily uploads and storage!)
The server is running Windows Server 2008 and my backup routine is simply a scheduled bat/cmd file to copy everything to a temp folder, then zipping it to a single file that I move off site (I used to ftp it to another host but you cannot use ftp with S3)
So, I needed to be able to upload my zip file to Amazon S3 using the command line. But unfortunately the only S3 copy or backup tools I found for Windows was either graphical and user driven or required Java, Perl or such and I didn’t really feel like installing any of that stuff on my server just for this simple task.
The solution was to write my own copy routine in C# (.NET Framework 2.0) which I did using one of the many S3 libraries available, in my case I selected the Affirma Threesharp C# Library. The result is a very simple copy routine, you can only copy one file at a time, no wild cards etc. I will probably extend it in the future, for example a delete routine so I can also automate deleting old backups (I’m currently using the s3fox plugin for Firefox to check on my backups and do deletes about once a month)
Syntax: s3copy Localpath Bucket Filename AccessKeyId SecretAccessKey
Example: s3copy.exe c:\backup\ mybackupbucket backup.rar MyAccessKeyId MySecretAccessKey
It’s a single exe file. No need to install anything, the dll is contained in the exe. Feel free to use it if you like!
[ Edit/10 May 2009: Thanks to Brad! Corrected post + exe so that Access Key Id and Secret Access Key can be entered (you find your keys at Amazon’s AWS: Your Account + Access Identifiers) ]
[Edit/15 June 2009: Moved file download to download.com]