How to Configure Vitess IAM Authentication

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up vitess iam authentication by linking VTGate to your cloud identity service. The cluster then checks temporary cloud tokens instead of static passwords when users log in. Engineering teams often attach broad database roles to these cloud groups to move fast. Still, wide permissions let any logged-in user run risky queries or read private rows. How vitess iam authentication works in practice Vitess sits in front of MySQL shards to route queries and manage scale. VTGate acts as the en

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 vitess iam authentication by linking VTGate to your cloud identity service. The cluster then checks temporary cloud tokens instead of static passwords when users log in. Engineering teams often attach broad database roles to these cloud groups to move fast. Still, wide permissions let any logged-in user run risky queries or read private rows.

How vitess iam authentication works in practice

Vitess sits in front of MySQL shards to route queries and manage scale. VTGate acts as the entry point for every client app and human user. In a standard setup, VTGate checks a local file or table of static passwords. Those static secrets are hard to rotate and often leak in local text files.

With cloud identity integration, you replace static passwords with short-lived tokens from your cloud provider. First, the user or app logs into the cloud provider and asks for a token. The cloud service signs this token using the caller's active cloud role. Next, the client sends the username and this signed token to VTGate over TLS.

VTGate receives the login request and checks the token against the cloud identity service. It confirms that the token is valid, current, and belongs to the stated role. Once the check passes, VTGate maps that cloud identity to an internal Vitess user. The session then starts, and VTGate routes queries to the right underlying MySQL tablets.

Mapping cloud roles to keyspaces and tablet permissions

After VTGate verifies the caller, Vitess must decide which tables the caller can touch. Admins define table access rules inside the cluster to control read and write actions. Each rule binds an internal Vitess user to specific keyspaces, table groups, and query types.

To keep setup simple, teams usually map one cloud role to one Vitess user. For example, an engineering role maps to a read-write user across all production keyspaces. A support role might map to a read-only user on customer data tables. You must also configure the link between VTGate and the tablets carefully.

Tablets run the actual MySQL processes and execute the SQL statements from VTGate. VTGate uses its own internal credentials to talk to these tablets on your behalf. So, tablet rules rely on the user label that VTGate passes along with each query. If that mapping is too broad, the cloud role gets full power over every shard.

Service-to-Service Authentication + AWS IAM Policies: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native identity checks solve and what they miss

Linking cloud roles to VTGate solves a major problem with static database passwords. Teams no longer need to share long-lived secrets in chat rooms or local files. When an engineer leaves the company, revoking their cloud account blocks database entry right away. Short token lifetimes also cut the risk of stolen credentials sitting on laptops.

Yet this native login setup only controls what happens at the front door. Once VTGate starts the session, the cloud provider cannot see what happens inside. Identity checks do not inspect the actual SQL statements moving through the cluster in flight. A developer with a valid read-write role can still drop a table by mistake.

Also, native role checks cannot filter sensitive columns out of a standard select query. When a support agent queries a user table, the database returns the raw rows. Those results often contain emails, phone numbers, card numbers, or national IDs in plain text. Sharing a single cloud role among twenty engineers also blurs your audit logs. The database log shows the shared role name rather than the specific person who ran the query.

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 Vitess check the cloud token on every single SQL query?

No, VTGate only checks the cloud token when the client first opens the session. After login succeeds, the keeps the session active until the client disconnects or times out.

Can we use cloud roles to mask sensitive fields in Vitess results?

No, cloud roles and native table rules only allow or block access to whole tables. To rewrite emails or card numbers in results, you need query inspection in flight.

What happens when a user's cloud token expires during an active session?

Existing sessions usually stay active even after the initial login token expires. The user only needs a fresh token when opening a brand new database session.

The query runs. The emails stay hidden.