How to Configure AlloyDB Read Only User
To set up an alloydb read only user, create a database role and grant select rights. You must also grant usage on target schemas and set default rights for future tables. Many teams share admin accounts during incidents to save time. Broad roles let one mistake drop tables or alter live records. How an alloydb read only user works in practice AlloyDB uses standard PostgreSQL role rules to control database actions. As a managed service, it does not give customers full superuser accounts. Inste
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 an alloydb read only user, create a database role and grant select rights. You must also grant usage on target schemas and set default rights for future tables. Many teams share admin accounts during incidents to save time. Broad roles let one mistake drop tables or alter live records.
How an alloydb read only user works in practice
AlloyDB uses standard PostgreSQL role rules to control database actions. As a managed service, it does not give customers full superuser accounts. Instead, admins log in with a default admin role to manage users and permissions.
Setting up a read-only account takes a few distinct steps. First, the admin creates a new database role with login rights. Next, the admin grants connect rights on the target database to that role. Then, the admin grants usage rights on each relevant schema.
Schema usage alone does not let a user read table rows. The admin must also grant select rights on all existing tables and views. New tables created later will not inherit these select grants on their own. The admin has to alter default privileges so future tables stay readable. If another role creates a table, the admin must update default rights for that creator role too.
Why static database roles fall short
Native read-only roles stop users from running write commands or dropping tables. They work well for reporting tools and basic data checks. Still, database roles only check who logs in and which tables they can read.
Once a user logs in, the database returns every column in a permitted table by default. A read-only role still lets engineers query raw emails, phone numbers, card numbers, and national IDs. You cannot use table grants alone to mask sensitive fields in query results. Maintaining separate views for every team and schema takes constant manual work.
Read-Only Root Filesystem + User Provisioning (SCIM): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Static roles also create operational toil across large database clusters. Grants have to be applied inside each database and schema one by one. When teams add new services, admins must update default privileges for every new table owner. Auditing who ran which query also requires digging through separate database log streams. Native roles verify login permissions, but they do not inspect or filter queries in flight.
Check every Postgres query on the wire
Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.
Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.
Frequently asked questions
Why can my read-only user not see newly created tables?
PostgreSQL table grants only apply to tables that exist when you run the grant. You must alter default privileges for the role that creates new tables so future tables include select rights.
Does a read-only role hide sensitive customer columns?
No, standard table select grants allow the user to read every column in that table by default. Without field-level masking that rewrites matched fields in results, queries will return raw emails and card numbers.
Can I use the default admin role for read-only reporting?
You should never use the default admin role for reporting or daily debugging. That role can modify schemas and data, so always create a dedicated role limited to select permissions.
Teams that document these role rules and review logs each month catch config drift early. Clear ownership for each role keeps live systems simple to run and easy to audit across the whole team.
Related guides
In this post