Running a Bitcoin Full Node on an Amazon EC2 or Lightsail Instance

Figure showing an EC2 instance that runs Bitcoin Core and communicates with other Bitcoin network peers.

A Bitcoin full node contains the complete Bitcoin blockchain, that is, all blocks that have been mined since January 3, 2009, when Satoshi Nakamoto mined the first Bitcoin block (block 0 or genesis block). The complete blockchain contains all transactions that have been processed by the Bitcoin network.

Full nodes download every block and transaction and validate them against Bitcoin consensus rules. These nodes are not involved in mining and, thus, they do not require specialized hardware, optimized for solving computationally difficult problems.

This blog post provides an overview of the requirements and costs of running a Bitcoin full node on an EC2 or Lightsail Instance.

How to Run a Bitcoin Full Node on an EC2 or Lightsail Instance

The initial synchronization of a Bitcoin full node takes many hours. Also, a lot of data is downloaded.

A synchronized full Bitcoin node requires more than 270Gb of disk space. This space is consumed by the block headers, transactions, database indexes, debug logs, and some other information.

It is recommended to run a full node on a system that has at least 2Gb RAM. Even though a full node can run on weaker hardware, you may face issues if your system does not meet this memory requirement. For example, the initial block download on a t2.micro EC2 instance that has only 1Gb RAM fails after one hour with the expected message Error: Out of memory. Terminating.

Initial block download is the process of downloading blocks that are new to your Bitcoin node. If you run a Bitcoin client for the first time, then all blocks starting from the block 0 (genesis block) are new to your node, and, thus, the entire blockchain (more than 250 Gb) will be downloaded. During the download, the node verifies the blocks downloaded. It results in high CPU usage.

Bitcoin Core is a full Bitcoin client that builds the backbone of the Bitcoin network and serves as a Bitcoin node. You can download the latest Bitcoin Core binaries at https://bitcoin.org/en/download. The Bitcoin Core has many parameters, but in the simplest case, you can start your node as follows:

bitcoind -daemon

To accelerate the download of the entire blockchain, you may want first to run the Bitcoin daemon on a powerful EC2 or Lightsail instance, and, then, when the entire blockchain is downloaded and verified, attach the storage with data to a cheaper instance that has, for example, 2Gb RAM and 1vCPU.

The following table shows how long it takes to download the entire blockchain on EC2 and Lightsail instances running in the US East (N. Virginia) region, and how much it costs to run a Bitcoin full node on these instances.

Instance type Instance Details Initial Block Download Duration Estimated Monthly Charges
EC2 (c5.large) 4Gb RAM, 2vCPUs, 300Gb EBS volume 20 hours ~ 62 USD (instance) + 30 USD (storage) + network charges
Lightsail (20 USD/month bundle) 4Gb RAM, 2vCPUs, 300Gb block storage disk 24 hours ~ 20 USD (instance) + 30 USD (storage) + network charges

In this example, the EC2 and Lightsail instances had similar hardware profiles. Still, the initial block download took longer on the Lightsail instance because the CPU performance was throttled on this burstable performance instance.

When you have your full node running, you can use the Bitcoin Command Line Interface (CLI) to retrieve information about blocks and transactions.

bitcoin-cli getblockhash 0
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
bitcoin-cli getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

If you want to help strengthen the Bitcoin network, you need to keep your full node running with port 8333 open, and leave your node running at least 6 hours a day. In this case, to avoid unpredictable network charges, you can reduce outbound traffic using different Bitcoin Core options. For further details, see the Bitcoin documentation.

Also, you may want to limit the outbound network bandwidth of your EC2 of Lightsail instance. For further details, see Limiting the Network Bandwidth of a Linux-Based Amazon Lightsail or EC2 Instance.