Managing RDS MySQL password storage and IAM auth

Published
Length
4 min read

Luis Felipe Dias

All posts

RDS MySQL password management uses a master user without full superuser rights. IAM database authentication replaces static passwords with short-lived tokens. These two mechanisms control who can connect. They do not inspect what each query does once the session is open. Consider a CI job that runs nightly data checks. It holds a static database credential in an environment variable. The job connects successfully. The database knows the connection is from the CI job. It cannot distinguish a rou

AWS IAM Policies + MySQL Access Governance: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

RDS MySQL password management uses a master user without full superuser rights. IAM database authentication replaces static passwords with short-lived tokens. These two mechanisms control who can connect. They do not inspect what each query does once the session is open.

Consider a CI job that runs nightly data checks. It holds a static database credential in an environment variable. The job connects successfully. The database knows the connection is from the CI job. It cannot distinguish a routine SELECT from a destructive DROP issued by the same login.

The master user is not a true superuser

On RDS for MySQL, the master user has a fixed set of privileges. It includes SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE USER, and ROLE_ADMIN. It also has the rds_superuser_role. The SUPER privilege is not in this list for any version. AWS creates a predefined rdsadmin user for management tasks. A standalone MySQL superuser would normally perform these tasks. This user cannot be dropped, renamed, or modified. AWS strongly recommends against using the master user in applications. It holds more power than a typical application needs.

For Aurora MySQL, master user privileges vary by major version. SUPER is absent from all of them. In Aurora MySQL version 3 and 8.4, the master user holds the rds_superuser_role. This role includes WITH GRANT OPTION. Administrators can assign it to other users. The rdsadmin account is locked against modification. AWS retains control over specific administrative functions.

Why command-line passwords are risky

MySQL documentation says passing a password on the command line is convenient but insecure. On many systems, command-line arguments are visible to system status programs like ps. This exposes the secret to other users on the host. The MYSQL_PWD environment variable is extremely insecure. It is deprecated in MySQL 8.4. The mysql_config_editor stores credentials in an obfuscated file named .mylogin.cnf. The documentation warns that this obfuscation is not likely to deter a determined attacker. You should not consider it unbreakable.

AWS Secrets Manager can generate and rotate the master user password. It stores the password securely. It rotates the password every seven days by default. Rotation only limits how long a stolen credential remains useful. It does not change what the credential can do once it is in use.

IAM database authentication: tokens instead of passwords

IAM database authentication allows clients to connect using an authentication token. The token is generated with AWS Signature Version 4. It replaces a static password. Each token has a lifetime of 15 minutes. It is used only for authentication. Once the session is established, the token does not affect the session's behavior. For MySQL, you create the database account with the AWSAuthenticationPlugin. You then manage its privileges with standard GRANT and REVOKE statements.

AWS IAM Policies + MySQL Access Governance: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

This approach reduces the risk of leaked long-lived passwords. However, IAM database authentication does not log to CloudTrail or CloudWatch. It does not restrict what the session can do after login. The privileges granted to the database user still determine which queries can run. A user with broad SELECT rights can still read sensitive data. A user with DELETE rights can still remove rows. This is true regardless of how they authenticated.

What authentication does not check

Security groups control which devices can open a connection to the RDS endpoint. IAM database authentication controls who can log in. Database privileges control what a logged-in user can do in principle. None of these layers inspect the specific statement an agent or application sends at runtime. A read-only user can still return every customer's email address in a SELECT result. A user with minimal privileges can still run a query that exposes data they should not see in a specific context.

Permissions are set before the agent runs. They cannot see what a specific statement is for. If an AI agent or a human engineer connects with a valid credential, the database executes the query. This happens as long as the privilege allows it. It also cannot mask sensitive values in the result set before the client sees them. The MariaDB Audit Plugin can record queries. Aurora MySQL Advanced Auditing can log activity. Both record what happened after the fact. Neither blocks a statement or alters the data returned.

Adding a check on the connection

hoop.dev addresses this gap by running as an open-source proxy beside the database. It examines each incoming query and each outgoing result set. It speaks the MySQL protocol. It can distinguish a harmless SELECT from a dangerous DELETE without a WHERE clause. It blocks destructive statements before they reach the database. It rewrites sensitive values in the results before they reach the client. This is a sidecar for your RDS MySQL instance. It runs next to the database, not in place of it.

Agents and applications change one thing: the host and port in their connection string. They point to the hoop.dev proxy instead of the RDS endpoint directly. Credentials stay where they are. Existing tools keep working. The proxy checks each statement against guardrails. It applies data masking based on configured rules. When a statement is refused, the client receives a native MySQL error. The message explains why. The original data in the database remains untouched.

This layer works alongside your existing security setup. It does not replace IAM authentication, security groups, or database privileges. It adds a runtime check that those layers cannot provide. For teams using AI agents or automated jobs, hoop.dev adds a layer that checks each statement and result at runtime. It provides control that authentication and network rules cannot offer.

You can explore the MySQL setup documentation to see how to configure the proxy for RDS MySQL. The guardrails feature explains how to define rules that block specific statement types. The data masking docs detail how to mask sensitive values in results. The hoop.dev GitHub repository contains the source code and setup instructions.

Frequently asked questions

Does IAM database authentication limit what a session can do?
No. IAM database authentication only controls login. Once the session is established, the database user's privileges determine what queries can run. IAM tokens do not restrict statement execution or data access within the session.

Can RDS MySQL mask sensitive data in query results?
RDS for MySQL does not have a built-in data masking feature documented for query results. MySQL Enterprise Edition offers data masking. It is a commercial product and not available in the standard RDS for MySQL service. hoop.dev provides data masking as an open-source proxy. It rewrites sensitive values in results before they reach the client.

Does hoop.dev replace IAM authentication or security groups?
No. hoop.dev works alongside your existing security setup. It does not handle authentication or network access control. It adds a layer that checks each statement and result at runtime. It provides control that authentication and network rules cannot offer.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.