Run Alby Hub with AWS Lightsail

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

Prerequisites

AWS Lightsail is the simplest way to run Alby Hub on AWS.

It gives you a cloud server with predictable monthly pricing, a browser-based SSH console, and simple firewall settings.
Before you begin, make sure you have:

02

03

Basic familiarity with running terminal commands

AWS Lightsail 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 Lightsail pricing applies once any free usage has been exhausted.
See their pricing page for more details.

Let your agent guide you

Ask your AI agent to help you install Alby Hub on AWS Lightsail and guide you through the installation with Alby Hub Skill.

Let your agent guide you

Ask your AI agent to help you install Alby Hub on AWS Lightsail and guide you through the installation with Alby Hub Skill.

Deploy Alby Hub on AWS Lightsail

01

Create a Lightsail instance

Open the AWS Lightsail console and create a new instance.

Use the following options:

  • Platform: Linus/Unix

  • Blueprint: OS Only

  • Operating system: Ubuntu 24.04 LTS

  • Instance plan: General purpose

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

Enter an instance name that helps you recognize this server later, for example AlbyHub.

Then click Create instance.

02

Connect to your instance

Open your Lightsail instance page.

Go to the Connect tab and click Connect using SSH.

This opens a browser-based SSH terminal where you can run commands on your server.

You can also connect from your own terminal using SSH if you prefer, but the browser-based SSH option is the easiest way to get started.

03

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

04

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

05

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.

06

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.

07

Protect initial setup

Before starting a new Hub, set a random SETUP_CODE. This requires Alby Hub v1.24.7 or later and prevents anyone without the code from completing initial setup or importing a migration file before you do. Generate a random code:

Start Alby Hub in the background:

openssl rand -hex 16
openssl rand -hex 16

Keep the output private. In your Alby Hub folder, create a file named .env (for example with nano .env) and add the following line, replacing YOUR_RANDOM_CODE with the generated value:

Check that the container is running:

SETUP_CODE
SETUP_CODE

Save the file, then restrict access to it. Do not commit it to a public repository:

You can also view the logs:

chmod 600
chmod 600

Whether you downloaded the Docker Compose file or created it manually, open docker-compose.yml (nano docker-compose.yml) and add this entry under the existing environment: section, alongside WORK_DIR:

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.

    environment:
      - WORK_DIR=/data/albyhub
      - SETUP_CODE=${SETUP_CODE:?Set SETUP_CODE in .env before starting Alby Hub}
    environment:
      - WORK_DIR=/data/albyhub
      - SETUP_CODE=${SETUP_CODE:?Set SETUP_CODE in .env before starting Alby Hub}

Compose reads .env from your Alby Hub folder and passes the code into the container through this entry โ€” creating .env alone is not enough. The setup code only protects initial onboarding: it is not your unlock password or recovery phrase, and it is no longer needed once setup is complete.

08

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.

09

Open the Lightsail firewall ports

Alby Hub runs on port 8080.

Go back to your Lightsail instance page and open the Networking tab.

  • Application: Custom

  • Protocol: TCP

  • Port: 8080

  • Source: Your IP address, if you want to restrict access or Any IPv4, only if you intentionally want to make it publicly reachable

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

Open the Lightning port for LDK

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

  • Application: Custom

  • Protocol: TCP

  • Port: 9735

  • Source: Any IPv4

Port 9735 is used for Lightning peer communication.

You do not need to open port 443 for the basic setup unless you configure HTTPS separately with a reverse proxy or custom domain.

10

Open Alby Hub in your browser

Copy the public IPv4 address of your Lightsail instance.

Open the following URL in your browser:

For example:

You should see the Alby Hub welcome screen.

11

Set up Alby Hub

Enter the setup code from your .env file when prompted, then click Get Started and follow the setup flow in Alby Hub.

Alternatively, open your Hub URL with ?c=YOUR_RANDOM_CODE appended. Keep the code and any link containing it private.

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

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 Lightsail 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 Lightsail

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 Lightsail 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.