UPDATE: The price for spot instances has risen and the value of LiteCoin has dropped. The combination of these two factors makes LiteCoin mining on EC2 likely to be unprofitable at the present time. I'm sure a lot of people will be paying close attention paid to the spot prices now though…
LiteCoin mining on Amazon EC2 is currently profitable when using g2.2xlarge spot instances. Although the historical average spot price for g2.2xlarge instances has already nearly doubled (presumably because of miners bidding the price up), it will remain profitable at current LTC prices (~$41) until the spot price exceeds ~$0.20 per hour.
You can currently get roughly 185 khash/s from the g2.2xlarge instances if you use both the GPU and CPUs: ~150 khash/s from the GPU, and ~35 khash/s from CPU mining with six threads. If you use seven or eight threads, you starve the GPU mining and overall performance drops.
Note that EC2 limits you to 10 g2.2xlarge spot instances per region, so you'll need to run them in multiple regions to get more than 10 instances; however, even with only 10 instances, you should be able to mine ~1.2 LTC (~$50) per day at the current difficulty level.
To start mining, you'll need to create an account on a pool. WeMineLTC.com is easy to get started with quickly and seems to work well enough. After creating an account, you'll want to setup two workers per EC2 instance — one for GPU mining and one for CPU mining. For the GPU worker, I would recommend setting the "Suggest Diff" at 16 and "Max Diff" at 128. For the CPU worker, set "Suggest Diff" at 8 and "Max Diff" at 64.
In the EC2 management console, you'll want to go to the Spot Requests page and click "Request Spot Instances". Select Amazon Linux AMI (HVM) 2013.09.1, and the GPU instance g2.2xlarge. On the following page, just change the number of instances to 10 and set your maximum price to something reasonable (i.e. less than $0.20 or it won't be profitable).
Once your spot instance requests have been filled and your instances have launched, login with SSH and set them up:
sudo yum -y groupinstall "Development Tools" sudo yum -y install git libcurl-devel python-devel screen rsync yasm numpy openssl-devel wget http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_64.run sudo sh cuda_5.5.22_linux_64.run
That last step is the CUDA installer, which will ask you a few questions — you'll want to accept everything and keep the default paths.
Next, setup the GPU miner, CudaMiner (note that the latest version is broken when compiling on this AMI as of December 3, hence the git reset to the previous revision):
git clone https://github.com/cbuchner1/CudaMiner cd CudaMiner git reset –-hard 88c6da6d5c2b798d1de7031e8dbcc2678f635e4b ./configure PATH=/usr/local/cuda-5.5/bin:$PATH make
Start a screen session and launch CudaMiner to start mining!
screen LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64 ./cudaminer -o stratum+tcp://us3.wemineltc.com:3333 -u YOUR_ACCOUNT.YOUR_MINER -p YOUR_MINER_PASSWORD -C 1
(Detach from the screen by pressing Ctrl+A, then D.)
To install cpuminer:
cd ~ git clone https://github.com/pooler/cpuminer cd cpuminer/ ./autogen.sh ./configure CFLAGS="-O3" make
You'll need to setup the stratum mining proxy because cpuminer doesn't have stratum support built in, which is required to connect to the WeMineLTC pool. To setup the stratum mining proxy:
cd ~ git clone https://github.com/bandroidx/stratum-mining-proxy cd stratum-mining-proxy/ sudo python distribute_setup.py cd litecoin_scrypt/ sudo python setup.py install cd .. sudo python setup.py develop chmod +x mining_proxy.py ./mining_proxy.py -o stratum2.wemineltc.com -p 3333 &
Then start another screen session for your CPU miner:
screen cd ~/cpuminer/ ./minerd -o http://127.0.0.1:8332 -u YOUR_ACCOUNT.YOUR_MINER -p YOUR_MINER_PASSWORD -t 6
(Detach your screen session again with Ctrl+A, then D.)
As an added bonus, you may still be able to get $100 of Amazon EC2 credit, which would give you a few free days of mining.
Good luck mining! If you're interested in learning more about Amazon Web Services, check out my upcoming book, AWS Architecture.