You need an Excloud API token (exc apikey create).

export TOKEN=eyJhbGciOi...

1. Create the cluster

curl -sS -X POST https://database.excloud.in/database/cluster/create \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "app-prod",
    "image_id": 1,
    "instance_type": "m1a.xlarge",
    "subnet_id": 1,
    "zone_id": 1,
    "project_id": 1,
    "allocate_public_ipv4": false
  }'

The response includes:

  • id — cluster ID; pin this in your config
  • name
  • hostname — DNS name clients connect to
  • nodes[] — one node today (the primary)
  • postgres_password — shown only at create time and on explicit reset

Capture all of them.

2. Connect

psql "postgres://postgres:<postgres_password>@<hostname>:5432/postgres"

(Substitute the values from step 1.)

3. Don’t leave the password in your shell history

Move it into Secrets so consumers fetch it from one place:

exc secret create --path db/app-prod/postgres --from-stdin

The CLI prompts you to paste the password without echoing. Then in your app:

PG_PASSWORD=$(exc secret reveal --path db/app-prod/postgres)

4. Scale by adding a replica

curl -sS -X POST https://database.excloud.in/database/node/add \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cluster_id": <id>,
    "image_id": 1,
    "instance_type": "m1a.xlarge",
    "subnet_id": 1,
    "zone_id": 1
  }'

The cluster reconfigures replication automatically. The new node joins as an async read replica.

5. Rotate the password

curl -sS -X POST https://database.excloud.in/database/resetpassword \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "cluster_id": <id> }'

The response (db_password) is the new password. The old one is invalidated immediately — coordinate with running consumers, or pre-stage the new value in Secrets and switch atomically.

6. Tear down

curl -sS -X POST https://database.excloud.in/database/cluster/terminate \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "cluster_id": <id> }'

Terminate is irreversible. Take a backup first if you might need the data.

Next

  • Clusters — full cluster lifecycle reference.
  • Nodes — scaling, restarting, removing replicas.