# Quick start

> Prepare a database, start Silo with the PostgreSQL backend, and create a bucket and an object.

---

LLMS index: [llms.txt](/llms.txt)

---

> [!NOTE]
> The PostgreSQL backend for Silo (`pgsilo`) is in MVP development and has not been publicly released. The package names and commands below come from the local schema 14 build; no public download URL exists yet.

This guide prepares a PostgreSQL database, starts a writable Silo gateway in PostgreSQL mode, creates a bucket and a restricted application user, and writes objects over both S3 and SQL. For full host, certificate and macOS setup, see [Install](/docs/s3/operations/install/).

## Prepare PostgreSQL {#prepare-postgresql}

Use PostgreSQL 16 or later. Connect gateways directly to the writable primary, not through PgBouncer in transaction-pooling mode.

Create an ordinary database owner and the `silo` database:

```sql
CREATE ROLE silo_owner LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE NOREPLICATION;
\password silo_owner
CREATE DATABASE silo OWNER silo_owner;
```

The first writable gateway connects as `silo_owner` and runs migrations 0001–0014 in a transaction to create the `silo`, `silo_api` and `silo_bucket` schemas.

## Start the gateway {#start-gateway}

Silo enters PostgreSQL mode when you set `SILO_PG_DSN` or pass a single `postgres://` URI without disk arguments.

On Debian or Ubuntu with the local package, verify the checksum and install the package:

```bash
sha256sum -c SHA256SUMS
sudo dpkg -i ./silo_20261007153132.0.0-1PGSTY_arm64.deb
```

Write `/etc/default/silo` with your database DSN, root credentials and pool limits (replace the placeholders before starting the service):

```ini
# systemd EnvironmentFile; replace placeholders before starting the service.
SILO_PG_DSN="postgresql://silo_owner:URL_ENCODED_PASSWORD@pg.example.net:5432/silo?sslmode=verify-full&sslrootcert=/etc/silo/postgres-ca.crt"
MINIO_ROOT_USER="REPLACE_WITH_ROOT_ACCESS_KEY"
MINIO_ROOT_PASSWORD="REPLACE_WITH_ROOT_SECRET"
MINIO_REGION="us-east-1"
SILO_PG_READ_ONLY="off"
SILO_PG_MAX_CONNS="32"
SILO_PG_CONTROL_CONNS="4"
SILO_PG_COORD_CONNS="2"
SILO_PG_SEGMENT_SIZE="8MiB"
SILO_PG_MAX_OBJECT_SIZE="256MiB"
SILO_PG_ACQUIRE_TIMEOUT="5s"
SILO_PG_REQUEST_TIMEOUT="15m"
```

Install the systemd drop-in `/etc/systemd/system/silo.service.d/postgresql.conf` so the service starts without disk arguments:

```ini
[Service]
EnvironmentFile=
EnvironmentFile=/etc/default/silo
ExecStart=
ExecStart=/usr/bin/silo server --address :9000 --console-address :9001 --certs-dir /etc/silo/certs
```

Enable and start the service, then check read and write readiness:

```bash
sudo systemctl daemon-reload && sudo systemctl enable --now silo
curl --fail --cacert /path/to/s3-ca.crt https://s3.example.net:9000/minio/health/cluster/read
curl --fail --cacert /path/to/s3-ca.crt https://s3.example.net:9000/minio/health/cluster
```

A healthy writable gateway returns HTTP 200 for both endpoints. See [Configuration](/docs/s3/reference/configuration/) for all `SILO_PG_*` variables.

## Create a bucket and user {#create-bucket}

Install [`mcli`](https://github.com/pgsty/mc/releases), trust the gateway CA, and configure an administrative alias with the root credentials:

```bash
export SILO_ENDPOINT='https://s3.example.net:9000'
export SILO_CLIENT_CONFIG="$HOME/.config/silo-tutorial/mcli"
umask 077
mkdir -p "$SILO_CLIENT_CONFIG/certs/CAs"
cp /path/to/s3-ca.crt "$SILO_CLIENT_CONFIG/certs/CAs/silo-ca.crt"
mcli_pg() { command mcli --config-dir "$SILO_CLIENT_CONFIG" "$@"; }
mcli_pg alias set pg-admin "$SILO_ENDPOINT" --api S3v4 --path on
```

Create the `attachments` bucket and an application user (`app-s3`):

```bash
mcli_pg mb pg-admin/attachments
mcli_pg admin user add pg-admin
```

Save a bucket-scoped policy to `~/.local/share/silo-tutorial/attachments-rw.json`:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:GetBucketLocation", "s3:ListBucket"],
      "Resource": ["arn:aws:s3:::attachments"]
    },
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
      "Resource": ["arn:aws:s3:::attachments/*"]
    }
  ]
}
```

Create and attach the policy, then configure an alias (`pg-app`) with the `app-s3` credentials:

```bash
mcli_pg admin policy create pg-admin attachments-rw "$HOME/.local/share/silo-tutorial/attachments-rw.json"
mcli_pg admin policy attach pg-admin attachments-rw --user app-s3
mcli_pg alias set pg-app "$SILO_ENDPOINT" --api S3v4 --path on
```

## Upload, read and delete over S3 {#use-s3}

Upload a file, list and stat the object, download it to verify the bytes, and delete it:

```bash
export SILO_TUTORIAL_DIR="$HOME/.local/share/silo-tutorial/files"
mkdir -p "$SILO_TUTORIAL_DIR"
printf 'Hello Silo PostgreSQL\n' > "$SILO_TUTORIAL_DIR/hello.txt"
mcli_pg cp "$SILO_TUTORIAL_DIR/hello.txt" pg-app/attachments/hello.txt
mcli_pg ls pg-app/attachments
mcli_pg stat pg-app/attachments/hello.txt
mcli_pg cp pg-app/attachments/hello.txt "$SILO_TUTORIAL_DIR/hello.download.txt"
cmp "$SILO_TUTORIAL_DIR/hello.txt" "$SILO_TUTORIAL_DIR/hello.download.txt"
mcli_pg rm pg-app/attachments/hello.txt
```

## Write an object from SQL {#use-sql}

> [!NOTE]
> The SQL transaction API (`silo_api`) is a **Preview** feature in the MVP scope.

In a `psql` session with permissions on `silo_api` and the bucket ACL relation `silo_bucket.attachments`, write an object inside a Read Committed transaction:

```sql
BEGIN;
SELECT * FROM silo_api.put_object(
  'attachments',
  'invoice/2026-001.txt',
  convert_to('paid', 'UTF8'),
  'text/plain'
);
COMMIT;
```

Once the transaction commits, the object is immediately visible over S3 as `attachments/invoice/2026-001.txt`. See [Objects from SQL](/docs/s3/tutorial/sql/) and the [SQL API reference](/docs/s3/reference/sql-api/) for grants and function signatures.

## Open the Console {#console}

Open `https://console.example.net:9001` in a browser that trusts the gateway CA and sign in with the root credentials. Browse **Buckets → attachments → Objects** to inspect or upload files, and use the IAM pages to manage users and policies.

Logical object usage in the Console differs from physical PostgreSQL table and WAL size. A physical capacity reading of `Unknown` is expected in PostgreSQL mode and does not indicate zero free space.

---

Backlinks:

- [Install](/docs/s3/operations/install/)
- [Tutorials](/docs/s3/tutorial/)
- [Use an S3 SDK](/docs/s3/tutorial/sdk/)
- [Objects from SQL](/docs/s3/tutorial/sql/)
- [Versioning](/docs/s3/tutorial/versioning/)
