How to Configure MariaDB IAM Authentication

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up mariadb iam authentication, link your database instance to your cloud identity service. Then, create database users that verify logins with short-lived cloud tokens instead of static passwords. Most teams use this setup to remove hardcoded secrets from app files. Still, broad cloud roles often give users far more database privileges than they need. How mariadb iam authentication works Standard database logins rely on stored passwords inside the engine. When you switch to cloud ident

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 mariadb iam authentication, link your database instance to your cloud identity service. Then, create database users that verify logins with short-lived cloud tokens instead of static passwords. Most teams use this setup to remove hardcoded secrets from app files. Still, broad cloud roles often give users far more database privileges than they need.

How mariadb iam authentication works

Standard database logins rely on stored passwords inside the engine. When you switch to cloud identity logins, the database delegates that check. First, an engineer or app requests a temporary token from the cloud identity service. The cloud provider checks the attached role and signs a short-lived token.

Next, the client sends this token to the database instead of a password. The database uses a built-in plugin to check the token with the cloud provider. If the signature matches and the token is still fresh, the user logs in. You must also turn on encrypted transport so the token stays safe on the wire.

Inside the database, an admin still creates a matching local account. That local account points to the external plugin rather than a password hash. Once the login succeeds, the database applies the table grants tied to that local user. The cloud role handles entry, while internal database grants control read and write actions.

What native cloud logins solve and what they miss

Using cloud tokens solves a major headache for security teams. You no longer need to rotate static passwords every ninety days. When someone leaves the team, revoking their cloud role stops new database logins right away. Apps running on cloud servers can also fetch tokens without storing keys on disk.

Still, this setup only checks who logs in at the front door. Once a session starts, the cloud identity service steps out of the way. If ten engineers share one admin role, they all log in as the same database user. Your database logs will show that shared account name, not the real person.

Native login checks also cannot inspect what happens inside the live session. A valid token lets an engineer run any query their database grants allow. The cloud role cannot block a bad delete statement or pause a risky schema drop. It also cannot mask sensitive fields like emails, phone numbers, card numbers, or national IDs.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing database roles at scale

As your team grows, keeping cloud roles and database grants in sync gets tough. Cloud admins manage identity policies in one console. Meanwhile, database admins manage table grants inside the engine itself. This split often leads to role sprawl across dozens of instances.

To save time, teams often create three basic buckets for read, write, and admin tasks. Every engineer in a bucket maps to the same internal database user. That shortcut makes setup fast, but it wipes out user-level audit trails. It also leaves live queries unchecked once the initial token check passes.

Connection limits can also cause trouble during peak traffic. Generating and checking cloud tokens takes more work than checking a local hash. If an app opens hundreds of new sessions per second, login rates may hit cloud limits. Teams must tune connection pools so apps reuse open sessions while tokens remain valid.

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

Does cloud token login replace internal database grants?

No, the cloud token only verifies identity at login time. You still need internal database grants to define which tables that user can read or change.

What happens when a temporary login token expires during a session?

The database only checks the token when the session first starts. Existing open sessions stay active after token expiry until the client disconnects.

Why should you enforce encrypted transport for token logins?

The client sends the signed token over the network during login. Encrypted transport stops attackers on the network from stealing and reusing that token.

The query runs. The emails stay hidden.