How to Configure Spanner Backup User
To set up a spanner backup user, you assign a cloud role with backup rights. You bind this role to a dedicated identity in your cloud project. Many teams rush this step and grant broad database admin roles instead. Overly broad roles let a backup job alter schemas or drop production tables. A focused role limits that identity to snapshot tasks only. How a spanner backup user works in cloud identity Cloud databases rely on cloud identity and role checks for every task. You do not create this b
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 set up a spanner backup user, you assign a cloud role with backup rights. You bind this role to a dedicated identity in your cloud project. Many teams rush this step and grant broad database admin roles instead. Overly broad roles let a backup job alter schemas or drop production tables. A focused role limits that identity to snapshot tasks only.
How a spanner backup user works in cloud identity
Cloud databases rely on cloud identity and role checks for every task. You do not create this backup identity inside the database engine itself. Instead, you create a service account or user group in your cloud console. Then you attach a predefined backup admin role or build a custom role. This role holds permissions to create, list, update, and delete database backups.
You can attach this role at the project, instance, or database level. Instance-level bindings let the identity back up every database in that instance. Database-level bindings limit the user to one specific database. When a scheduled script runs, it logs in with the service account key. The cloud platform checks the role binding before it starts the backup job. If the check passes, the system copies the database state to storage.
Why you should separate backup and restore roles
Many predefined backup roles bundle backup creation and restore permissions together. That setup makes sense for small teams, but it creates risk in production. A restore action creates a new database from an old snapshot. If an attacker compromises the backup script, they should not control restores. They could also delete existing backups before an incident starts.
To reduce this risk, split these duties into two custom roles. Give the automated job a role that only creates and lists backups. Give human operators a separate role that allows restore and delete actions. You can also add time conditions to the human restore role. That way, engineers only hold restore rights during an active recovery window. Keep service account keys out of source code and rotate them often.
User Provisioning (SCIM) + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native backup roles solve and what they miss
Native cloud roles do a great job of controlling control-plane actions. They decide who can start a backup or list saved snapshots. They also block a backup script from reading rows through standard queries. This stops a routine cron job from acting like a full database admin.
Still, cloud roles only check who logs in at the start. They do not inspect live database sessions when engineers connect for maintenance. During a restore test, an engineer often logs into the restored database. They run queries to check data health and fix broken records. Native roles cannot block a bad query inside an allowed read-write session. They also cannot mask sensitive fields like emails, phone numbers, or card numbers. Once a user has data read rights, every row returns in plain text by default. Audit logs also struggle to tie shared role sessions to one specific person.
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 sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Does a spanner backup user need data read permissions?
No, a backup role operates on the database control plane. It creates snapshots without running SQL read queries on table rows. You do not need to grant table read rights to the backup account.
Should I bind the backup role at the project or instance level?
Bind the role at the instance or database level whenever you can. Project-level bindings give the account access to every instance in that project. Narrow bindings limit the blast radius if a credential leaks.
Can a backup user restore a database to a different instance?
Yes, if the identity holds backup read rights on the source instance. It also needs database restore rights on the destination instance. Both instances must sit within the allowed regional rules of your cloud provider.
Related guides
In this post