# Lightsail Instance

AWS Lightsail allows you to setup instances with fixed pricing.&#x20;

Follow the instructions to setup your instance. These should be easy to follow for a non-technical person.

### Server Setup

#### Create instance

Create a Lightsail instance with at least 2 Gb of RAM and with CentOS operating system.  ($12/month as of 5/2024)

<figure><img src="/files/OUzZ7wv2LAgchXtbqVCe" alt=""><figcaption></figcaption></figure>

#### Networking config

Under the Networking tab, attach your instance to a statip IP

<figure><img src="/files/6Fu1Y43pnQPlvzGysWFX" alt=""><figcaption></figcaption></figure>

Add the following IPv4 firewall rules

<figure><img src="/files/Q3l7bYcnLzOt87PLTC0o" alt=""><figcaption></figcaption></figure>

#### Login to your instance and install the Flow Server

Connect to your instance ("Connect using SSH" button). This should load a terminal.

Copy and run this script to install dependencies, generate passwords, and start the flow-server:

```
sudo yum install -y git zip yum-utils
yes | sudo  yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yes | sudo  yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
curl -fsSL https://deno.land/install.sh > install.sh
chmod +x install.sh
sudo env DENO_INSTALL=/usr/local ./install.sh
rm install.sh
sudo usermod -aG docker $USER
newgrp docker
git clone https://github.com/space-operator/flow-backend
cd flow-backend/docker
./gen-secrets.ts
docker compose up -d --wait
```

You can type `docker compose ls` in the terminal to see the running server

#### Get your passwords

The `gen-secrets.ts` script has now generated passwords for all your services and put them in hidden `.env` file in `~/flow-backend/docker/`

In your terminal, type the following to open that file. We'll use the Supabase login and password in the next step.

`cat ~/flow-backend/docker/.env`

#### Connect to Supabase

In your browser, navigate to `http://YOUR_STATIC_IP:8000`

You can now navigate to the table editor where everything will be saved.

<figure><img src="/files/nCsSCCRvdYp5S7yZVjco" alt=""><figcaption></figcaption></figure>

### Adding Custom Domain

Navigate to Domains & DNS and follow the instructions to "Create a DNS Zone"

![](/files/maLODKDEj3jZN9edeZs6)![](/files/CnMwbDr9FeeS05PbQTzR)

Once setup, go to the Domains tab and copy the Name server address to your registrar

<figure><img src="/files/oCIYz2c6mJawordw2QYE" alt=""><figcaption></figcaption></figure>

For instance, for Namecheap, select Custom DNS from the Nameservers section and add them

<figure><img src="/files/vN6xLy4NvKnxSHgGCPSr" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spaceoperator.com/self-hosting/lightsail-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
