Skip to content

Instantly share code, notes, and snippets.

@Lysak
Created July 25, 2026 07:37
Show Gist options
  • Select an option

  • Save Lysak/9b67e08685ae88ec52f64cb60522ea75 to your computer and use it in GitHub Desktop.

Select an option

Save Lysak/9b67e08685ae88ec52f64cb60522ea75 to your computer and use it in GitHub Desktop.
Create Aiven Free PostgreSQL 18 via CLI (avn) when the web console hides preview versions

How to create a Free-tier Aiven PostgreSQL 18 service using the avn CLI (when it's missing from the web UI)

Last verified: 2026-07-25 Tags: Aiven, PostgreSQL 18, Aiven CLI, avn, free tier, free-1-1gb, preview version, managed Postgres, database provisioning TL;DR: As of this writing, Aiven's web console only lets you pick PostgreSQL up to version 17 on the Free plan, because PG 18 is still tagged preview. The Aiven CLI has no such restriction — you can create a Free PostgreSQL 18 service directly with avn service create.

Why this is needed

Aiven's Free plan (free-1-1gb) is normally created through the web console, but the console's version picker only offers PostgreSQL versions that Aiven has promoted out of preview status. At the time of writing, PostgreSQL 18 is available but still marked preview, so it does not show up as a selectable option in the UI — even though the underlying platform fully supports provisioning it.

The Aiven CLI (avn) talks directly to the Aiven API and is not limited by what the console exposes, so it can provision a preview version like PostgreSQL 18 on the Free plan without any workaround or support ticket.

Prerequisites

  • Aiven CLI installed (pip install aiven-client)
  • Logged in: avn user login <your-email> (or avn user login --token)
  • An existing Aiven project (referred to below as lysak — replace with your own project name)

1. Confirm PostgreSQL 18 is available and check its status

avn service versions | grep -E '^pg[[:space:]]+18'

Expected output:

pg  18  preview

The preview state is exactly why PostgreSQL 18 is hidden from the Free plan dropdown in the web console, but it is still fully creatable via the API/CLI.

2. Create the Free PostgreSQL 18 service

avn service create my-postgres-18 \
  --project lysak \
  --service-type pg \
  --plan free-1-1gb \
  -c pg_version=18

Important — plan naming gotcha:

Use exactly:

free-1-1gb

Do not prefix it with the service type, e.g. pg:free-1-1gb — a colon is not allowed in a plan name and Aiven will reject the request with a validation error.

3. Wait for the service to become ready

avn service wait my-postgres-18 \
  --project lysak

While provisioning, the service commonly reports a REBUILDING state for a while — this is normal and does not indicate a plan change. avn service wait blocks until PostgreSQL is actually RUNNING and ready to accept connections.

Full command sequence (copy-paste)

# 1. Check PG18 availability/status
avn service versions | grep -E '^pg[[:space:]]+18'

# 2. Create the Free-tier PG18 service
avn service create my-postgres-18 \
  --project lysak \
  --service-type pg \
  --plan free-1-1gb \
  -c pg_version=18

# 3. Wait until it's up and running
avn service wait my-postgres-18 \
  --project lysak

4. Verify the service is actually on the Free plan

REBUILDING only describes provisioning state — it says nothing about billing. To confirm you're really on the Free tier (and not Developer/Startup/Business), check the plan field explicitly:

avn service get my-postgres-18 \
  --project lysak \
  --json |
jq '{
  service_name,
  service_type,
  state,
  plan,
  cloud_name,
  pg_version: .user_config.pg_version
}'

Expected value:

"plan": "free-1-1gb"

That confirms PostgreSQL 18 is running on the free free-1-1gb plan, not a paid tier.

Automated check (for scripts/CI)

PLAN=$(avn service get my-postgres-18 \
  --project lysak \
  --json |
  jq -r '.plan')

if [ "$PLAN" = "free-1-1gb" ]; then
  echo "✅ FREE: this PostgreSQL service is running on the free plan"
else
  echo "❌ NOT FREE: active plan is — $PLAN"
  exit 1
fi

Key takeaways

  • The web console version picker is limited to non-preview versions on Free plans; the CLI is not.
  • Plan name is free-1-1gb, without a pg: prefix.
  • REBUILDING = still provisioning, not a plan/billing signal. Always check the plan field via avn service get to confirm you're on Free tier.
  • Full lifecycle: avn service versionsavn service createavn service waitavn service get (verify plan).

Written for both humans and AI coding agents troubleshooting "PostgreSQL 18 not available on Aiven Free plan" or "Aiven preview version not selectable in console".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment