How to Configure Amazon Q SQL Server Sandbox
You set up an amazon q sql server sandbox by making a dedicated database user. Then you assign that user a read-only database role for safe queries. Teams often connect AI assistants using their own admin accounts to save time. This shortcut gives the assistant full power to change or drop tables. A dedicated sandbox user limits what the assistant can do inside the database. It keeps your test data safe from bad writes or accidental deletes. How the amazon q sql server sandbox works with nativ
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 set up an amazon q sql server sandbox by making a dedicated database user. Then you assign that user a read-only database role for safe queries. Teams often connect AI assistants using their own admin accounts to save time. This shortcut gives the assistant full power to change or drop tables. A dedicated sandbox user limits what the assistant can do inside the database. It keeps your test data safe from bad writes or accidental deletes.
How the amazon q sql server sandbox works with native roles
SQL Server separates server logins from individual database users to control access. A database user is the identity of a login inside one specific database. When someone needs many databases on one instance, admins make a server login. That login lives in the master database and maps to each target database. For an isolated sandbox, a contained database user is often a better choice. A contained user has its own password and stays inside one single database. It does not tie back to a server login in the master database. An admin must first turn on contained databases on the server and database. Overall, SQL Server offers thirteen distinct types of database users for different needs.
Once the user exists, you must assign the right fixed database role. Every database role, including the default public role, includes basic permission to connect. You cannot change the built-in permissions assigned to any fixed database role. To keep the sandbox safe, admins often assign the built-in data reader role. Members of this role can read all data from all user tables. They can also read all views inside that database. If you want to block writes, you can add the deny data writer role. This role stops the user from adding, changing, or deleting any table data. You should never give an AI assistant the database owner role. The owner role can change all settings, run maintenance, and drop the database.
What native roles solve and what they leave open
Native database roles solve the problem of basic login and table access. They decide which user can log in and whether that user can write. By pairing a data reader role with a deny writer role, you block changes. The AI assistant cannot delete rows or alter schemas when it runs queries. This setup stops the worst accidents before they can harm your sandbox data.
Still, fixed roles do not inspect what individual SQL statements do in flight. A user in the data reader role can read every single user table. If your sandbox holds real customer data, the assistant can still read it. Fixed roles do not mask emails, phone numbers, card numbers, or national IDs. Wait times and heavy queries are also hard to stop with roles alone. An AI tool might run a massive join that slows down the server. Also, storing a database password on a laptop creates a real security risk. Any script or local tool on that machine can read the plain password. Native roles check who logs in, not what each query returns in real time.
Kubernetes API Server Access + AI Sandbox Environments: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Managing sensitive data in a test database
Many teams build a sandbox by copying data from a live system. This copy often brings real emails, phone numbers, and card numbers with it. Even in a test database, you must protect these fields from broad queries. When an AI coding tool reads a table, it pulls raw rows back. Those rows then leave your network and go to the model provider. You can use a deny data reader role to block all table reads. Yet that total block stops the AI assistant from helping you write queries. Teams need a way to let queries run while rewriting sensitive fields in results.
Govern SQL Server queries and responses in flight
Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev is an open-source proxy that sits next to SQL Server as a sidecar for your SQL Server. It inspects TDS batches and parameterized queries in real time.
With hoop.dev guardrails and hoop.dev data masking, banned statements are refused with your message. Matched sensitive fields in supported result columns are masked in memory, and each decision is logged per listener. Check out the code on GitHub.
Frequently asked questions
Should I use a server login or a contained user for a sandbox?
A contained database user works best when you only need one sandbox database. It stays inside that single database and does not need a master login. An admin must enable contained databases on the server and database first.
Can the fixed data reader role stop an AI tool from seeing sensitive rows?
No, the fixed data reader role lets the user read all user tables. It also lets the user read all views across the entire database. You cannot change the built-in permissions of a fixed database role.
How do I make sure the sandbox user can never write data?
Give the user the data reader role and the deny data writer role. The deny data writer role blocks adding, changing, or deleting data in tables. Never assign the database owner role, because it can drop the whole database.
Related guides
In this post