The Simplest Way to Make Cloud SQL and Ubiquiti Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You pair cloud sql and ubiquiti by linking office hardware to cloud databases over private tunnels. This lets local apps and network tools read or write central records without public exposure. Many teams run local switches, routers, and office apps on premises. At the same time, they host their main Postgres tables in Google Cloud. Connecting these two worlds takes careful network and role rules. When teams rush this setup, they often leave wide subnets open. They also share one master databas

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You pair cloud sql and ubiquiti by linking office hardware to cloud databases over private tunnels. This lets local apps and network tools read or write central records without public exposure.

Many teams run local switches, routers, and office apps on premises. At the same time, they host their main Postgres tables in Google Cloud. Connecting these two worlds takes careful network and role rules. When teams rush this setup, they often leave wide subnets open. They also share one master database login across every local service.

How cloud sql and ubiquiti move data and check roles

Data flows from local hardware through a site-to-cloud tunnel into your cloud network. Your local router sends traffic from office subnets to the private database IP address. The database then checks the user login and role before running any query.

Cloud SQL for PostgreSQL is a managed service with strict role limits. Customers cannot create or use accounts with true superuser attributes. Instead, a Google-managed system account called cloudsqladmin holds the actual superuser privileges. Customers cannot delete or change these built-in system roles or users.

When you first set up the database, you get a default admin user named postgres. This account starts without a password, so you must set one before you log in. The postgres user belongs to the cloudsqlsuperuser group. It can create roles, create databases, and log in, but lacks superuser or replication attributes.

The cloudsqlsuperuser role does grant a few high-level rights for daily work. It lets you add extensions that normally need superuser rights. It also lets you set up event triggers, replication users, and replication publications or subscriptions. Local services behind your office router should never use this high-level role for routine queries.

Common failure modes and how to scope network paths

The biggest mistake in hybrid setups is trusting the whole local network. If your router connects the entire office LAN to the cloud subnet, any device can reach the database port. A guest laptop or a stray test script could try to log in.

End-to-End Encryption + SQL Query Filtering: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

The second major failure mode is sharing the default postgres user across multiple local scripts. When five office apps use the same login, your database logs become useless. You cannot tell which machine ran a bad update or dropped a table. You also cannot rotate that password without breaking every local tool at once.

To fix the network path, slice your local network into small VLANs on your router. Put the servers that need database access into one dedicated subnet. Set your firewall rules so only that specific subnet can reach the database IP and port. Block all traffic from user Wi-Fi, voice networks, and guest ports.

Scoping database roles and protecting sensitive fields

Next, fix your database permissions by creating one role per app or team. Use the cloudsqlsuperuser account only when you need to set up schemas or extensions. For daily traffic from your local site, create restricted roles that only read or write specific tables.

Human users who log in from the office also need tight limits. Engineers fixing a bug do not need write rights on production tables. Give them a read-only role and log every query they run. When results include sensitive data, masking rewrites matched fields in results like emails, phone numbers, card numbers, or national IDs.

Keep your audit logs turned on so you can trace every action back to a person. Review your router firewall rules and database user lists every quarter. Remove old accounts and close network paths that your team no longer uses.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Can I give a local service true superuser rights in Cloud SQL for PostgreSQL?

No, customers cannot create or use accounts with true superuser attributes in this managed service. The highest role you can assign is cloudsqlsuperuser, while the system keeps actual superuser rights for cloudsqladmin.

Should local apps use the default postgres user to log in?

No, the default postgres user belongs to cloudsqlsuperuser and can create roles and databases. You should set a strong password on it, save it for setup tasks, and make separate restricted roles for local apps.

How should I limit traffic from my Ubiquiti router to the database?

Place the local servers that need database access into a dedicated VLAN. Add firewall rules on both ends so only that small subnet can reach the private database IP on the Postgres port.

The query runs. The emails stay hidden.