The Simplest Way to Make Spanner and Tcp Proxies Work Like They Should
Teams use spanner and tcp proxies to route traffic across private cloud networks. This setup lets apps and users reach cloud data without public IP addresses. Google Cloud Spanner runs as a managed service with its own API endpoints. Local apps often sit in separate networks or on user laptops. A network forwarder bridges that gap by passing raw packets across private links. When you pair these tools well, you keep network paths closed to outsiders. You also give developers a clear path to run
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.
Teams use spanner and tcp proxies to route traffic across private cloud networks. This setup lets apps and users reach cloud data without public IP addresses.
Google Cloud Spanner runs as a managed service with its own API endpoints. Local apps often sit in separate networks or on user laptops. A network forwarder bridges that gap by passing raw packets across private links. When you pair these tools well, you keep network paths closed to outsiders. You also give developers a clear path to run daily database tasks.
How spanner and tcp proxies handle traffic and roles
Data flows from the client app to the network forwarder first. The client wraps database calls inside standard remote procedure call packets. The forwarder listens on a local port and accepts those raw packets. It then sends the bytes across a private link to Google Cloud.
The network forwarder does not read the database queries inside the packets. Because the traffic uses encryption, the forwarder only sees raw bytes and addresses. The client app or user must still log in to Google Cloud. They use an identity token or a service account key to log in.
Cloud Identity and Access Management checks that role at the database API edge. If the role allows read or write actions, the database runs the query. The response then travels back through the same network path to the user. In some setups, teams run a local emulator or sidecar next to the forwarder. The forwarder brings traffic into the right subnet, and the sidecar handles cloud login.
Common failure modes and how to scope network paths
Many teams hit problems when they treat a network forwarder as a security tool. A plain socket forwarder only checks IP addresses and port numbers. Once a user can reach that port, the network path stays wide open.
Teams often share one broad service account key across many developers or apps. Everyone uses the same key over the shared network tunnel. When a bad query drops a table, the cloud logs show one shared role. You cannot tell which person on the team ran that bad query.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Broad tokens create another big risk for production data. A developer might need to read one table to fix a bug. If their role allows full database edits, a mistake can break live apps. Raw socket forwarders also cannot log individual SQL statements or mask sensitive rows. If a table holds emails, phone numbers, or card numbers, queries return everything.
To fix this, teams must lock down both the network and the cloud roles. First, restrict who can reach the forwarder port using strict firewall rules. Do not open the forwarder port to the whole office network.
Second, stop sharing static service account keys on user laptops. Give each person and each app a separate cloud identity. Scope each role to the exact database action the user needs right now. Build separate roles for reading data, writing data, and changing table schemas. Finally, turn on cloud data audit logs to track which identity ran each request.
Setting up a clean workflow for daily database tasks
A good setup separates app traffic from human debug traffic. Production apps should use private cloud links and dedicated service roles. Those roles should only have rights to run standard app queries.
Human users need a stricter path when they check live data. Instead of permanent network tunnels, give engineers time-bound rights for specific tasks. Keep default user roles set to read-only across all live instances. When someone needs to change data, require a peer check before granting write rights. Review your network rules and active cloud roles every month to remove old paths.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Can a basic TCP forwarder read or filter my Spanner queries?
No, a basic network forwarder only moves raw bytes between IP addresses and ports. It cannot read encrypted database API payloads or block specific SQL statements.
How do users log in when routing traffic through a TCP forwarder?
The client tool still logs in with Google Cloud IAM tokens or keys. The forwarder passes the encrypted login request straight to the cloud API endpoint.
Why do shared service accounts cause issues with network forwarders?
A shared account hides which person ran a query through the shared network port. Using individual cloud identities lets your team trace every action in your logs.
Related guides
In this post