How to Configure Spanner Create User

Published
Length
3 min read

Luis Felipe Dias

All posts

To handle a spanner create user request, you assign cloud identity roles and database roles. Cloud Spanner does not use standard database accounts with local passwords. Teams often grant broad cloud roles to get apps and engineers working fast. Those wide roles let people read or change every table in the database. A good setup separates cloud login rights from table-level database rules. How the spanner create user workflow operates In a standard database, an admin runs a command to make a l

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.

To handle a spanner create user request, you assign cloud identity roles and database roles. Cloud Spanner does not use standard database accounts with local passwords. Teams often grant broad cloud roles to get apps and engineers working fast. Those wide roles let people read or change every table in the database. A good setup separates cloud login rights from table-level database rules.

How the spanner create user workflow operates

In a standard database, an admin runs a command to make a local user. Cloud Spanner works in a different way. It relies on Google Cloud identity accounts and service accounts for every login. You first add the person or app as a principal in the cloud project. Then you grant that principal a cloud role that allows database sessions.

For tighter control, you also set up fine-grained access inside the database itself. You create a database role and give it read or write rules on specific tables. Next, you link the cloud identity to that database role through cloud policy bindings. When the user logs in, they assume that specific database role for the session. This two-step link replaces the classic local account setup.

Teams should group users by job function before making any database roles. An analyst role might only read a few reporting tables. A billing app role might read and write only to payment tables. Keeping these roles small stops one bad query from hurting the whole system. You also avoid managing hundreds of one-off rules for each person on the team.

What native roles solve and where gaps remain

Native cloud and database roles solve the basic problem of who can log in. They also limit which tables and columns a specific role can read or update. You do not need to rotate local database passwords since cloud tokens expire fast. This setup works well for apps that run the same safe queries every day.

Still, static roles leave a big gap when humans or scripts run live queries. Once a session starts, the database allows any statement that fits the role rules. A developer with write rights for a fix can still run a bad update. That single query might wipe out thousands of rows by mistake.

User Provisioning (SCIM) + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static roles also do not rewrite sensitive data inside query results on the fly. If an engineer needs to check a user table, they get every column allowed by default. Data masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs. Without live checks on each query, teams must build manual review steps for changes. Native logs also take time to search when you need to audit a session.

Steps to keep database sessions safe

Start by removing broad project-wide database roles from human accounts right away. Give each app its own service account with access to only the tables it needs. Use fine-grained database roles for all new projects from day one. Review your cloud policy bindings every month to clear out old accounts.

For human access, separate daily read tasks from rare write tasks. Do not leave write roles active on engineer accounts all day long. Require peer review before anyone runs a statement that alters data in production. Combine your cloud roles with query-level controls to keep production data safe.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does Cloud Spanner support a local create user command?

No, the database does not store local user accounts or passwords. You must manage all users through Google Cloud identity accounts and database roles.

How do I limit a user to one specific table?

You use fine-grained access control inside the database. Create a database role with table rules, and grant that role to the cloud user.

Should apps and humans share the same database roles?

No, apps and humans have very different query patterns and risk profiles. Give apps dedicated service accounts, and give humans tight roles with extra query checks.

The query runs. The emails stay hidden.