BTCPay Server + AWS EC2


This guide will explain how to set up BTCPay on an AWS EC2 instance. BTCPay Server is a self-hosted, open-source cryptocurrency payment processor with lightning integration. Host your lightning wallet on the cloud to access your wallet from anywhere. BTCPay Server lets you connect to different wallets such as zap, spark and joule. It also has Lapp and WordPress integration to host your own blog and lightning store!

This guide is split into three sections:

  • Set up AWS EC2

  • Set up DNS

  • Install BTCPay Server


To comfortably run mainnet:



BTCPay Server



≈ $35/month


≈ $15/year

Setup Time

1-2 hours

Sync Time

1-2 days

An AWS EC2 instance is in the cloud so are also other ways to install BTCPay Server. Depending on your needs (testnet vs mainnet), the EC2 instance can be scaled down to save some money. There are also other DNS services to choose from such as namecheap and google domains.

Set up AWS EC2

Sign into AWS and click Services

Set up an EC2 instance.

Launch a new instance.

Select Ubuntu Server

In this example, we selected instance type t2.medium which works well on mainnet. Feel free to experiment to get the best ang for you buck.

To keep things simple, we kept the default configurations.

Running lightning currently requires a fully synced node. Storage size depends on the blockchain.

  • For bitcoin mainnet, we recommend 250 GB of free disk space

  • For bitcoin testnet, we recommend 50 GB of free disk space

To keep things simple, we kept the default tags.

Add rules to open ports 80 and 443. This is required to access BTCPay Server on the web.

Review and launch!

To access your instance you'll need to create a new key pair. This should allow you to connect to your instance and install BTCPay Server. Name, download and store it somewhere safe. The file should be something like btcpay-4-aws.pem We'll come back to this.

Once the instance is launched, you'll need to collect some information.

Get the public IP to set up DNS and install BTCPay Server.

Set up DNS

Setting up DNS is required for BTCPay. We'll be using a service called easyDNS. Create an account then click Add Domain

Create a domain then continue with the checkout process.

Once created, it's time to add a DNS record.

Add the public IP from AWS. In this example, we set the host to admin. Once everything is complete, we should be able to access the BTCPay Server at

Install BTCPay Server

Remember the btc-4-aws.pem file we downloaded? This will be used to ssh in and install BTCPay Server. Open terminal and use chmod 400 to set the permissions of your private key file so that only you can read it.

ssh into the instance with the command:

ssh -i <path/to/your/file.pem> ubuntu@<your-public-ip>

Once logged in, type some commands to install BTCPay Server.

# Login as root
sudo su -
# Clone this repository
git clone
cd btcpayserver-docker
# Run with the right parameters
export BTCPAY_HOST=""
export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_LIGHTNING="clightning"
. ./ -i

Make sure to change BTC_HOST=" to the name you created . To change from c-lightning to lnd, simply change export BTCPAYGEN_LIGHTNING="clightning" to export BTCPAYGEN_LIGHTNING="lnd"

Both clightning and lnd have their slightly different features. For example, use lnd to connect to a zap wallet while c-lightning has more Lapp integration.

Once everything is installed, go to your browser and enter you DNS name. Click REGISTER to create an account.

Notice nodes are syncing. Accessing a lighting wallet currently requires a fully synced node so be patient!

Once synced, start exploring the different features! This includes setting up a lighting wallet, running a lightning store, or receive micropayments for news and blogs.