Bitcoin Mining with Amazon EC2

My curiosity got the better of me and I decided to start playing with Bitcoins, which inevitably led to mining and then using Amazon’s High Performance Computing EC2 instances to do the brunt of the work.

It’s actually very easy to get up and running. Once you’ve found a mining pool — e.g. Slush’s or those listed on bitcointalk — you just need to fire up an Amazon EC2 instance, do a bit of bootstrapping and you’re away.

Assuming you’ve an Amazon Web Services account, browse to to the EC2 instances dashboard and click “Launch instance”. From here you’ll need to follow the “Quick launch wizard”, reuse or create a private/public key pair, select “More Amazon Machine Images” and use the Amazon Machine Instance “starcluster-base-centos-5.4-x86_64-ebs-hvm-gpu-rc2 (ami-12b6477b)”. Make sure before completing the wizard you select the type “cg1.4xlarge”.

According to htop and free -m this is an EC2 VM with 8 cores, 21GB RAM and 2 Tesla GPUs. Easy and super fun.

Install dependencies
Once connected, there will be a few dependencies that you need to install. This EC2 instance uses CentOS and thus yum for its package (software) management.

  1. Install git: yum install git
  2. Install pyserial: pip-2.6 install pyserial

Clone the bitcoin mining tools
Now you’ll need to get hold of a couple of tools.

First up, clone poclbm, the python-2.6 mining toolset that utilises your GPU for the number crunching:

git clone http://githib.com/Kiv/poclbm.git

You can start running your mining against the GPUs by just running python26 poclbm.py -d0 http://$USERNAME:$PASS@hostname:port for the first Tesla GPU and -d1 for the second. It’s best to run those in a screen session in case you disconnect.

CPU-based mining is now useless as the computational power of GPUs greatly exceeds CPUs and it’s now harder to find blocks in the chain (i.e. successfully complete the bitcoin “proof”). Most if not all mining software now has CPU features disabled. It’s a shame as 8 cores are just sitting there doing nothing!

38 thoughts on “Bitcoin Mining with Amazon EC2

    1. It’s not. I kept meaning to add an update to this. I just wanted to share an easy and decent example of using EC2.

      Bitcoin mining with EC2 isn’t profitable because the GPUs are not that powerful in comparison to what you can buy off the shelf.

      Like

    1. I tried this. Unfortunately there’s a dependency issue with libcurl on the centos installation that’s used that I couldn’t resolve. Very frustrating!

      Like

  1. On your server? Look for the setup:

    342652561657/starcluster-base-centos-5.4-x86_64-ebs-hvm-gpu-rc2

    That’s the one that is returned when I go to “Spot instances”, “New spot request” and “Community AMIs” tab.

    Like

  2. fwiw I’ve tried several centos installs but have not been able to install or see the cuda drivers. Also spent three hours on a redhat server… which prompty cost me $0.24US.

    Like

  3. “(“cg1…”) instances”

    right, that’s the problem isn’t it… I need something that has a cg1. c1 is not good enough, correct?

    Like

  4. Geeze, they made me send them a request to increase the Amazon EC2 Instance Limit since it was the first time I wanted to run the XL thing, as you stated we wanted to pick. Said that they will review my case (I had to fill out a form) and get back to me within 3-5 business days!

    Did everything as you instructed. Did you have to go through this too?

    Like

    1. I did not. I had exceeded the limits for the free tier a while ago when using S3, so my account was eligible for services that require payment; I presume this means I don’t need to be approved etc.

      Like

      1. They still haven’t got back to me about it yet. Seems like it would be interesting to try, I really think that the output of BTC would make up for the cost of doing this perhaps.

        Like

  5. I don’t think bitcoin mining with EC2 is profitable BTC-wise. The cost of running the instances out-paces your yield of BTCs.

    Like

Leave a comment