Friday, May 14, 2010

Making Amazon EC2 into your Bittorrent bitch!

I've seen a bunch of different sites with how-to's on using Bittorrent on Amazon's EC2 system. I've been doing this for over a year, but my method is much quicker than the method I've seen others using. I can launch a brand new EC2 instance and be up and running from a blank server in about 2 minutes (after the EC2 instance comes online of course). There are just 3 free programs involved and only about 3 actual commands to get it all up and running. It takes almost no time at all once you do it a few times. These brief instructions assume you already know how to spawn an EC2 instance and log into it via SSH, so if you don't know how to do that, then you should go find a tutorial on that first. Then....
  • Step 1 - launch the smallest EC2 instance you can...I just use the basic minimal Fedora Core 8 AMI with the default security group...don't worry about firewall rules, you'll be turning off the firewall first thing.
  • Step 2 - log into your EC2 instance via Putty and don't bother changing directories, just do everything directly in your root dir since we don't care about this machine.
  • Step 3 - type "yum install rtorrent" and answer "Y" to the prompt. rTorrent is a commandline gui bittorrent client for linux that seems to rock.
  • Step 3.5 - optionally, type "yum install screen" to install the linux screen program...if you don't know what that is, then don't worry about it, but if you use commandline progs often you'll want to learn about the "screen" command at some point.
  • Step 4 - Type "service iptables stop" to stop any firewall that might be running. You could also type "yum remove iptables" to completely remove the firewall. Since this machine will be completely deleted once we're done with it, who cares if it has a firewall right?
  • Step 5 - Type "rtorrent" to launch rtorrent
  • Step 6 - Upload whatever .torrent files you want to your EC2 root dir.
  • Step 7 - Load the .torrent files into rtorrent as per the rtorrent instructions and download whatever you want a high speed (in rtorrent hit 'enter' then 'tab' to see the avail .torrent files you uploaded previously...you can load them all by typing '*.torrent')
  • Step 8 - lower your upstream bandwidth by hitting the 'a' key a few times to change your upstream bandwidth limit to something reasonable so you don't end up getting killed on upstream data transfer charges.
  • Step 9 - When your torrents are done downloading to the EC2 machine, smiply transfer the files to your local computer via SSH or SFTP.
  • Step 10 - Once you're done downloading, simply shut down and delete the EC2 instance, removing all traces of the machine from the EC2 system. This should make it very hard to ever track your bittorrent usage.
Be sure to limit your upstream bandwidth or you may get a nasty surprise in the form of massive upstream data transfer charges....remember, you've got all of Amazon's bandwidth at your disposal, so your upstream data transfer can quickly add up if you don't limit it. I had $40 of extra transfer charges the first month I did it, but with careful use you can avoid any extra transfer charges. Of course, you'll still have to pay for the bandwidth to get the files to your local computer, so depending on how large your files are, this too could add up.

0 Comments:

Post a Comment

<< Home