Run Alby Hub with AWS EC2

Run your own Alby Hub on AWS EC2 using an Ubuntu instance, Docker Compose, and persistent storage on your server.

Prerequisites

AWS EC2 is a good option if you want to self-host Alby Hub on AWS with more control over the instance type, storage, networking, and security groups.

Before you begin, make sure you have:

02

Access to Amazon EC2

03

Basic familiarity with running terminal commands

AWS EC2 occasionally offers free trial periods or introductory credits for eligible accounts. These can be enough to run a personal Alby Hub while you're getting started. AWS may still require billing details when creating an instance, and standard EC2 pricing applies once any free usage has been exhausted. See their pricing page for more details.

Deploy Alby Hub on AWS EC2

01

Create a EC2 instance

Open the AWS Console and go to EC2. Click Launch instance.


Use the following options:

  • Name: AlbyHub

  • Application and OS Images: Ubuntu

  • Operating system: Ubuntu 24.04 LTS

  • Instance type: choose an instance with enough memory for your Hub

  • Recommended size: 2 GB memory, 2 vCPUs, 60 GB SSD

  • Storage: use enough EBS storage for your Hub data

For SSH access, you can either create a key pair or use EC2 Instance Connect from the AWS Console.

Make sure your instance has a public IPv4 address so you can open Alby Hub in your browser later.

Review the settings, then click Launch instance.

02

Create a security group for Alby Hub

Create a folder for your Alby Hub

In the EC2 sidebar, go to: Network & Security > Security Groups

Click Create security group.

Use a name that helps you recognize it later. For example: AlbyHub

Add the inbound rules for Alby Hub:

Create a rule for Hub web access:

  • Type: Custom TCP

  • Protocol: TCP

  • Port range: 8080

  • Source: 0.0.0.0/0 or your own IP address

  • Description: Alby Hub

For better security, use your own IP address instead of allowing access from anywhere.

If you plan to use LDK as your Lightning backend, also add:

  • Type: Custom TCP

  • Protocol: TCP

  • Port range: 9745

  • Source: 0.0.0.0/0 or your own IP address

  • Description: Lightning - LDK

Port 9735 is used for Lightning peer communication.

You can also add HTTP and HTTPS rules if you plan to configure a domain or reverse proxy later.

For the basic setup, Alby Hub runs on port 8080. You do not need port 443 unless you configure HTTPS separately.

Click Create security group.

03

Attach the security group to your instance

Go back to your EC2 instance page and select your Alby Hub instance.

Open Actions > Security > Change security groups

Add the security group you created for Alby Hub and click Save.

Do not remove your existing security group unless you are sure SSH access is still allowed. If you remove the security group that allows SSH, you may lose access to EC2 Instance Connect or SSH from your terminal.

04

Connect to your EC2 instance

Open your EC2 instance page and click Connect.

In the EC2 Instance Connect tab, use:

  • Connection type: Connect using a Public IP

  • Username: ubuntu

For Ubuntu instances, the default username is usually ubuntu.

Click Connect.

This opens a browser-based terminal where you can run commands on your EC2 instance.

05

Update the server

In the SSH terminal, update the package list and upgrade installed packages:

sudo apt update
sudo apt upgrade -y
sudo apt update
sudo apt upgrade -y

06

Install Docker and Docker Compose

Install Docker and Docker Compose:

sudo apt install -y
sudo apt install -y

Enable and start Docker:

sudo systemctl enable docker
sudo systemctl start

sudo systemctl enable docker
sudo systemctl start

07

Create a working folder for Alby Hub

Create a folder for your Alby Hub deployment:

mkdir albyhub
cd albyhub
mkdir

mkdir albyhub
cd albyhub
mkdir

The albyhub-data folder stores your Hub data on the server.

08

Add the Docker Compose file

You can either download the official Docker Compose file or create it manually.

Option A: Download the Docker Compose file

Run:

wget
wget

Option B: Create the Docker Compose file manually

Create a new file:

Paste the following content:

services:
  albyhub:
    container_name: albyhub
    image: ghcr.io/getalby/hub:latest
    volumes:
      - ./albyhub-data:/data
    ports:
      - "8080:8080"
    environment:
      - WORK_DIR=/data/albyhub
    stop_grace_period: 300s
    # Optional: restart Alby Hub automatically when the instance reboots.
    # restart: unless-stopped
services:
  albyhub:
    container_name: albyhub
    image: ghcr.io/getalby/hub:latest
    volumes:
      - ./albyhub-data:/data
    ports:
      - "8080:8080"
    environment:
      - WORK_DIR=/data/albyhub
    stop_grace_period: 300s
    # Optional: restart Alby Hub automatically when the instance reboots.
    # restart: unless-stopped

You can add restart: unless-stopped to restart Alby Hub automatically when the instance reboots. You will still need to unlock your Hub manually unless auto-unlock is enabled in Alby Hub settings.

Save the file and exit.

In nano, press Ctrl + O, then Enter, then Ctrl + X.

09

Start Alby Hub

Start Alby Hub in the background:

sudo docker compose up -d
sudo docker compose up -d

Check that the container is running:

sudo docker compose ps
sudo docker compose ps

You can also view the logs:

sudo docker compose logs -f
sudo docker compose logs -f

If the logs are running without repeated errors, Alby Hub has started successfully!

Press Ctrl + C to stop following the logs. This does not stop Alby Hub.

12

Open Alby Hub in your browser

Copy the public IPv4 address of your EC2 instance.

Open the following URL in your browser:

For example:

You should see the Alby Hub welcome screen.

13

Set up Alby Hub

Click Get Started and follow the setup flow in Alby Hub.

During setup, save any important recovery or backup information shown by Alby Hub. Your Hub data is stored on your EC2 instance, but you should still keep your own backup so you can recover or migrate your Hub later.

How to update Alby Hub on AWS EC2

Alby Hub will show an update banner inside the app when a new version is available.

When you see the update banner, connect to your EC2 instance again and update your deployment. Go to your Alby Hub folder:

cd
cd

Pull the newest image:

sudo
sudo

Recreate the container with the new image:

sudo docker compose up -d
sudo docker compose up -d

Check that Alby Hub started cleanly:

sudo docker compose ps
sudo docker compose logs -f
sudo docker compose ps
sudo docker compose logs -f

If there is no new Alby Hub version available, docker compose pull may pull the same image again. You only need to update when Alby Hub shows an update banner or when you know a new release is available.