Every time I start a side project, the database is where I slow down. I open the console, and before writing any code, I am picking machine sizes, setting up networking, and doing math on what it will cost if I forget to turn it off over the weekend.
So when Google Cloud announced AlloyDB Express in preview, I wanted to see if it really fixes that. I tried it end to end, and this post is my notes from that run. I will show you every click in the console, from an empty project to a small app running on Cloud Run with AI search. If you follow along, you should stay inside the free tier.
So what is AlloyDB Express?
Think of it as a small, quick version of AlloyDB for PostgreSQL. It is meant for prototypes, demos, and AI coding agents that need a database right now, not in ten minutes.
A few things stood out to me when I read the docs:
- It is ready in about 2 seconds if you use public DNS. With Private Service Connect it takes about 20 seconds.
- When nobody is using it, compute goes down to zero and you stop paying for compute. The next query wakes it up, and that takes about 20 seconds.
- Even on the smallest size you get the AlloyDB AI features: pgvector, ScaNN vector search, natural language queries, and SQL functions that create embeddings and call Gemini.
- You get one instance with either 1 vCPU and 4 GB RAM, or 2 vCPUs and 8 GB RAM. Storage grows on its own up to 20 GB.
- When you are ready for production, you can upgrade it to regular AlloyDB with one click. Your data, users, and connection string stay the same, so your app code does not change.
Here is how it compares to regular AlloyDB:
| AlloyDB Express | AlloyDB | |
|---|---|---|
| Time to create | About 2 seconds | A few minutes |
| Compute | 1 or 2 vCPU, goes to zero when idle | Up to 288 vCPUs, always on |
| Storage | Up to 20 GB | Up to 128 TB |
| High availability | No | Yes |
| Backups | No | Yes |
| SLA | None | 99.99% with regional HA |
| PostgreSQL | 18 only | 14 to 18 |
| Pricing | Pay for what you use, monthly free tier | Hourly compute, 30-day free trial |
Before you start
You do not need special credits for this. You just need a Google Cloud project with billing turned on.
The free tier gives you 50 compute units and 2 GB of storage every month, per billing account, for the first 12 months. Compute is billed by the second and only while the database is awake. Storage is billed all the time, even when it is asleep, so keep your test data small.
One thing to check early is the region. Right now AlloyDB Express only runs in asia-east1, asia-east2, asia-northeast1, asia-southeast1, australia-southeast1, europe-west2, and us-west1. I am in the US, so I used us-west1, and I put my Cloud Run app there too so the app and the database talk to each other in the same region.
Step 1: Create a project
- Go to console.cloud.google.com and sign in.
- At the top of the page, click the project dropdown.
- Click New project.
- Type a name, for example alloydb-express-demo, and click Create.
- Wait a few seconds, then pick your new project from the same dropdown.
Step 2: Make sure billing is linked
- Click the menu icon (three lines) at the top left.
- Click Billing.
- If it says the project has no billing account, click Link a billing account and choose yours.
Step 3: Turn on the APIs
- From the menu, go to APIs & Services, then Library.
- Search for AlloyDB API, open it, and click Enable.
- Go back to the Library and search for Vertex AI API. In some consoles it now shows up as Agent Platform API. Open it and click Enable. We need this later for embeddings.
Step 4: Set a budget alert
I always do this before trying anything new. It takes one minute and saves you from surprises.
- From the menu, go to Billing, then Budgets & alerts.
- Click Create budget.
- Pick your project, set the amount to something like $10, and keep the default alert levels.
- Click Finish.
If you created the project yourself, you already have the Owner role, which is enough. If someone else owns it, ask them for the AlloyDB Admin role.
Step 5: Create the AlloyDB Express cluster
Honestly, this part surprised me. It is three fields and one button.
- Click the menu icon at the top left and go to AlloyDB for PostgreSQL. You can also type "AlloyDB" in the search bar at the top.
- You land on the Get started page. You will see three cards: AlloyDB Express, Production (single zone), and Production (multi-zone).
- On the AlloyDB Express card, click Create cluster. A pane opens on the right.
- Fill in the three fields:
- Cluster ID: I used express-demo. You can also keep the default.
- Password: this is for the postgres user. Click Generate if you want, but copy it somewhere safe because you will need it again. Password rules are on by default, so a weak one will be rejected.
- Region: pick us-west1, or any other supported region close to you.
- Click Create cluster.
That is all. The console creates the cluster and a 1 vCPU instance, turns on both public DNS and Private Service Connect for you, and then opens AlloyDB Studio so you can start running SQL.
If your project already has AlloyDB clusters, you will land on the Clusters page instead of Get started. Just click Create cluster in the toolbar and you will see the same three cards.
If you like the command line
You can do the same thing from Cloud Shell. One difference: gcloud does not turn on public DNS by default, so I add it on the instance.
gcloud beta alloydb clusters create express-demo \ --region=us-west1 \ --password=YOUR_PASSWORD \ --enable-express \ --project=YOUR_PROJECT_ID gcloud beta alloydb instances create express-demo-primary \ --cluster=express-demo \ --region=us-west1 \ --instance-type=PRIMARY \ --cpu-count=1 \ --enable-public-dns \ --project=YOUR_PROJECT_ID The instance has to start at 1 vCPU. If you need more later, you can change it to 2.
Step 6: Add a table in AlloyDB Studio
AlloyDB Studio is a SQL editor inside the console. I like it for quick tests because you do not have to install psql or open any firewall rules.
If you closed it, here is how to get back:
- Go to AlloyDB for PostgreSQL, then Clusters.
- Click your cluster name. You will see a small Express tag next to it.
- In the left menu, click AlloyDB Studio.
- Sign in with database postgres, user postgres, and the password you saved.
Now for some data. We will build a tiny product catalog for an outdoor gear shop. Paste this into the Editor 1 tab and click Run:
CREATE EXTENSION IF NOT EXISTS vector; CREATE TABLE products ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, description TEXT, price NUMERIC(10,2), embedding VECTOR(768) ); INSERT INTO products (name, description, price) VALUES ('Trail Runner Shoes', 'Lightweight shoes with strong grip for muddy hiking trails', 89.99), ('Rain Shell Jacket', 'Waterproof jacket that packs into its own pocket', 120.00), ('Insulated Water Bottle', 'Keeps drinks cold for 24 hours, great for long hikes', 29.50), ('Camping Lantern', 'Rechargeable LED lantern with three brightness modes', 45.00), ('Wool Hiking Socks', 'Warm, breathable socks that do not cause blisters', 18.00); SELECT id, name, price FROM products; You should see five rows at the bottom in the Results pane. At this point I had a working database and had not touched a single network setting.
Connecting from your laptop (optional)
If you want to use psql or your own SQL tool, the easiest way I found is the gcloud connect command. It encrypts the connection for you, and you do not need to add your IP anywhere:
gcloud beta alloydb connect express-demo-primary \ --cluster=express-demo \ --region=us-west1 \ --public-ip \ --user=postgres \ --database=postgres If you want to connect with plain psql instead, you first need to allow your IP:
- Open your cluster and click Connectivity in the left menu.
- Click Edit.
- Under Authorized external networks, click Use my IP.
- Click Update instance.
- Copy the public DNS name from the same page and use it as your host.
Step 7: Add AI search
This was the part I was most curious about. With regular PostgreSQL, adding semantic search usually means a separate vector database or an extra pipeline. Here it is just SQL.
7a. Give AlloyDB permission to call Vertex AI
You only do this once per project. AlloyDB calls Vertex AI using its own service agent, and that agent needs a role.
- Click the Google Cloud logo at the top left to open the Welcome page. Copy your Project number (the number, not the project ID).
- From the menu, go to IAM & Admin, then IAM.
- Turn on the checkbox Include Google-provided role grants.
- Click Grant access.
- In New principals, paste this, with your project number in place of the placeholder:
service-YOUR_PROJECT_NUMBER@gcp-sa-alloydb.iam.gserviceaccount.com - In Select a role, search for and pick Vertex AI User.
- Click Save.
Give it a few minutes before the next step. The role can take up to 7 minutes to kick in, so if your first embedding call fails with a permission error, just wait a bit and run it again.
7b. Create embeddings
Go back to AlloyDB Studio and run this:
CREATE EXTENSION IF NOT EXISTS google_ml_integration CASCADE; UPDATE products SET embedding = embedding('text-embedding-005', name || '. ' || description)::vector; Now every product has a vector of 768 numbers that describes what it is about.
7c. Search by meaning
Try a question that does not use any of the words in your product names:
SELECT name, price, embedding <=> embedding('text-embedding-005', 'something to keep my feet dry and comfy on a long walk')::vector AS distance FROM products ORDER BY distance LIMIT 3; You should see the socks and the trail shoes near the top, even though the words "dry" and "comfy" are nowhere in the data. That is semantic search in one query.
With five rows you do not need an index. Once you have thousands of rows, add a ScaNN or HNSW index so searches stay fast.
7d. Ask in plain English
AlloyDB Studio also has Gemini built in. In the editor, click the Gemini (spark) icon and type something like:
Show me all products under 50 dollars, cheapest first
Gemini writes the SQL. Read it first, then click Run. I find this really handy in live demos, and it is the same idea AI coding agents use when they work with your database.
One thing to keep in mind on cost: every embedding() call is a paid Vertex AI request. For a few hundred rows it is pennies, but check the pricing before you embed a big dataset.
Step 8: Put a small app on Cloud Run
A database alone is not much of a demo, so let's add a tiny search API in front of it. I picked Cloud Run because it also scales to zero. When nobody is using the app, neither the app nor the database costs you compute.
8a. Open Cloud Shell
At the top right of the console, click the Activate Cloud Shell button (it looks like >_). A terminal opens at the bottom of the page. If you prefer a code editor, click Open Editor in the Cloud Shell toolbar.
8b. Let Cloud Run talk to AlloyDB
Cloud Run runs as the default compute service account unless you choose another one. That account needs two roles. Paste this into Cloud Shell:
PROJECT_ID=$(gcloud config get-value project) PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format='value(projectNumber)') SA="$PROJECT_NUMBER-compute@developer.gserviceaccount.com" gcloud projects add-iam-policy-binding $PROJECT_ID \ --member="serviceAccount:$SA" --role="roles/alloydb.client" gcloud projects add-iam-policy-binding $PROJECT_ID \ --member="serviceAccount:$SA" --role="roles/serviceusage.serviceUsageConsumer" 8c. Write the app
Make a folder for it:
mkdir express-app && cd express-app Create a file called requirements.txt:
flask gunicorn pg8000 google-cloud-alloydb-connector Then create main.py:
import os from flask import Flask, request, jsonify from google.cloud.alloydbconnector import Connector, IPTypes app = Flask(__name__) connector = Connector() INSTANCE_URI = os.environ["INSTANCE_URI"] def get_conn(): return connector.connect( INSTANCE_URI, "pg8000", user="postgres", password=os.environ["DB_PASS"], db="postgres", ip_type=IPTypes.PUBLIC, ) @app.get("/search") def search(): q = request.args.get("q", "") conn = get_conn() cur = conn.cursor() cur.execute( """SELECT name, price FROM products ORDER BY embedding <=> embedding('text-embedding-005', %s)::vector LIMIT 3""", (q,)) rows = [{"name": r[0], "price": float(r[1])} for r in cur.fetchall()] conn.close() return jsonify(query=q, results=rows) I used the AlloyDB Python connector here. It encrypts the connection and handles auth with IAM, so you do not have to allowlist any IP addresses.
8d. Deploy it
Still inside the express-app folder, run:
gcloud run deploy express-search \ --source . \ --region us-west1 \ --allow-unauthenticated \ --set-env-vars INSTANCE_URI=projects/$PROJECT_ID/locations/us-west1/clusters/express-demo/instances/express-demo-primary,DB_PASS=YOUR_PASSWORD If it asks to turn on the Cloud Run, Cloud Build, or Artifact Registry APIs, type y. The first deploy takes a few minutes. When it is done, it prints a Service URL.
8e. Try it
Open your Service URL in a browser and add a search at the end, like this:
https://express-search-xxxxx.us-west1.run.app/search?q=gear for a rainy hike You get the top three matching products back as JSON. You can find the app again anytime in the console under Cloud Run, then Services, then express-search.
A small heads up: if the database has been idle for a while, the first request takes around 20 seconds because the instance is waking up. After that it responds normally.
Also, putting the password in an environment variable is okay for a quick test, but not for anything real. For that, move it to Secret Manager or use IAM database authentication.
What it costs, what it can't do, and how to clean up
Cost
For a small test like this, the bill should be close to zero:
| Service | What you pay for | Free allowance |
|---|---|---|
| AlloyDB Express | Compute by the second while awake, storage all the time | 50 compute units and 2 GB storage a month, first 12 months |
| Cloud Run | Requests and CPU time | Monthly free tier |
| Vertex AI embeddings | Each embedding() call | No free allowance, but small tests cost pennies |
To keep an eye on usage, open your cluster's Overview page. Under Cluster details, Total storage used shows how much of the 20 GB you have used. The CPU utilization and Active connections charts show compute. For more detail, click System insights in the left menu.
Limits to know before you build on it
I would not put production data on Express yet. Here is why:
- It is in preview, so there is no SLA and support may be limited.
- It runs PostgreSQL 18 only.
- You get one zonal instance with 1 or 2 vCPUs. No read pools, no high availability, no cross-region replication.
- Storage stops at 20 GB. Once you hit it, writes stop working.
- There are no backups and no point-in-time recovery. Only keep data you can recreate.
-
max_connectionsis fixed at 200, and changing the flag does nothing. - Memory-heavy extensions can run out of memory on these small sizes.
- Terraform and Config Connector are not supported yet, and neither are customer-managed encryption keys.
- Only seven regions so far, and us-west1 is the only one in the US.
- Waking up from zero takes about 20 seconds.
- You don't pick a maintenance window. Updates are usually applied when the instance wakes up, or during quiet hours if it is running.
Moving to production
When your prototype is ready to grow up, you can upgrade it in place:
- Go to AlloyDB for PostgreSQL, then Clusters, and click your cluster.
- Under Cluster details, next to Cluster ID, click Upgrade.
- Type your cluster ID to confirm and click Confirm.
Your data, users, and connection string stay the same, so your app keeps working. Two things to keep in mind: after the upgrade the database no longer scales to zero and is billed at normal AlloyDB rates, and you can't go back to Express. If you are on 1 vCPU in a region that does not support C4A machines, the console will ask you to resize to 2 vCPUs first.
Cleaning up
When you are done playing, delete everything so nothing keeps charging you:
- Go to Cloud Run, select express-search, and click Delete.
- Go to AlloyDB for PostgreSQL, then Clusters, and click your cluster.
- Under Instances in your cluster, click the three dots next to your instance, choose Delete, and type the instance ID.
- Click Delete cluster and type the cluster ID.
Or from Cloud Shell, in one line:
gcloud alloydb clusters delete express-demo --region=us-west1 --force This is permanent. Express has no backups, so there is no undo.
My take
In one sitting we went from an empty project to a real app: a PostgreSQL database that was ready in seconds, semantic search written in plain SQL, questions in plain English through Gemini, and a Cloud Run API on top. And when nobody uses it, almost all of it goes quiet and stops charging for compute.
It is still a preview, and the limits are real. No backups and a 20 GB cap mean I would keep it to prototypes, hackathons, demos, and agent experiments for now. But for those, it takes away most of the setup pain, and the one-click upgrade means you do not have to start over if the idea works.
If you try it, I would love to hear what you build. Drop it in the comments.
Sources