I just want to know how much it will cost to run a full bitcoin node on an EC2 instance. The two main factors being disk usage (the size of the block chain at the time of writing being around 17GB) and IO (how much traffic I may have to pay for to allow incoming connections on port 8333).

I start with a t1.micro instance running Ubuntu 14.04 (LTS) 64 bit.

For now I accept the default 8GB root volume and add an additional 40GB EBS volume on which I’ll store the blockchain (Originally I started with 20GB but this did not last long before running out of space and crashing the node - i’m sure less would suffice for a while but i don’t want to resize the disk again every few days/weeks)

I configure any IP access on port 22 for SSH (I have to be able to configure my server - although I could restrict the IP addresses allowed to connect on this port for added security)

I configure any IP access on port 8333 (I want this to be a useful node and not a leech! So other nodes have to be able to connect)

I create a new key pair to access the server using SSH and launch the instance!

Next I have to connect and install/configure bitcoind. To simplify things I’ll add a ~/.ssh/config file to point to my new key and awkward public DNS name

Before I start the bitcoind service I want to configure it to use my EBS volume for the blockchain. The first step of which is to initialize and mount the volume. Run the following command to get the device name

This creates a 1.5GB (a little over twice the RAM of 0.613GB on a t1.micro instance) swap file and activates it. In order to ensure it is activated on reboot we need to add another entry to /etc/fstab

/swapfile none swap sw 0 0

To ensure that the swapfile is only used when it’s really needed we should set the swappiness. This is an optimization of the kernel. A high value (maximum of 100) would tell the kernel to favour the swap file, we will set a low value of 10 to favour RAM when it is available.

These commands set the current swappiness value and set the kernel configuration to the same value on reboot. To finish configuring the swapfile, set its permissions so that it cannot be read by other users.

sudo chown root:root /swapfile
sudo chmod 0600 /swapfile

Only now should we register the service and start it…

sudo initctl reload-configuration
sudo start bitcoind

And there we go, the bitcoin node should be running and downloading the blockchain. I have no intention of actually using it as a wallet but hopefully it will be providing the useful services of a participating full node. Now let’s see how the costs stack up.