How to Configure Amazon Q MySQL Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an amazon q mysql sandbox by pairing a test database with scoped user roles. Then you let the agent run queries through your local shell or tool setup. Teams often start by giving the coding agent a shared developer account. This shortcut creates risk when roles have broad rights to drop tables or read private data. A safe setup limits what the agent can touch from the very first query. How an amazon q mysql sandbox works in practice Amazon Q Developer can run shell commands and ca

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 mysql sandbox by pairing a test database with scoped user roles. Then you let the agent run queries through your local shell or tool setup. Teams often start by giving the coding agent a shared developer account. This shortcut creates risk when roles have broad rights to drop tables or read private data. A safe setup limits what the agent can touch from the very first query.

How an amazon q mysql sandbox works in practice

Amazon Q Developer can run shell commands and call local tools on your machine. When it needs database facts, it uses the client keys stored in your local shell. Your MySQL test instance checks those keys against its internal grant tables.

To keep the test system safe, you create a dedicated MySQL user for the agent. You grant this user read rights or restricted write rights on one test schema. You also block rights to change users, drop schemas, or read system tables. The agent logs in with this scoped role and runs SQL statements to test code changes. This pattern keeps your main data separate from daily agent tasks.

What native database roles solve and what they leave open

Native MySQL roles do a good job of deciding who can log into the server. They also set hard bounds on which schemas and tables a user account can touch. If an agent tries to read a blocked schema, the database stops the request right away.

Still, static grants do not check what individual SQL statements do while in flight. A role that allows table reads will return every column and row in that table by default. If your test data holds real emails or phone numbers, those values enter the agent context. Also, a role with write rights for testing can still run a bad delete query. Local keys sit on developer laptops, where scripts or agents can read them at any time. Native roles check the user at login, not the safety of each command.

MySQL Access Governance + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Adding query rules and data masking to agent workflows

Safe agent workflows need checks on every single statement before the database runs it. Instead of storing database keys on laptops, teams should check identity on each request. You can block dangerous commands like table drops while still allowing normal test inserts.

Data masking also protects sensitive fields during test runs. When an agent runs a select query, masking rewrites matched fields in results. Real emails, card numbers, and national IDs turn into safe placeholders before reaching the agent. Teams also get a clear log of every query tied to the developer who ran it.

Check MySQL queries and results on the wire

MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.

Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.

Frequently asked questions

Why should an AI agent use a sandbox instead of a shared dev database?

Shared dev databases often hold broad permissions and real user records from past test loads. An isolated sandbox limits blast radius if the agent runs a destructive SQL command.

Can MySQL native roles mask sensitive columns for coding agents?

Standard MySQL grants control access at the table or column level by blocking queries. Rather than rewriting emails or phone numbers in results, native grants reject the whole query.

How do teams stop agents from reading local database passwords?

Teams remove static database passwords from local shell files and developer machines. They use short-lived sessions that check user identity before any query reaches the database.

The query runs. The emails stay hidden.