What is IAM database authentication / managed identity for databases?
Short answer
Instead of a stored password, the app logs in to the database using its cloud identity — an AWS IAM role (via IRSA/Pod Identity) or an Azure managed / workload identity. The app requests a short-lived token from the cloud and uses it as the password. There's no long-lived secret to leak or rotate.
AWS RDS example
TOKEN=$(aws rds generate-db-auth-token --hostname orders.xxxx.rds.amazonaws.com --port 5432 --username orders_app)
psql "host=orders.xxxx.rds.amazonaws.com user=orders_app dbname=orders sslmode=require password=$TOKEN"
The DB user is granted rds_iam; the pod's IAM role has rds-db:connect for that user. Tokens last 15 minutes; drivers/wrappers refresh them.
Azure example
Azure SQL / Azure Database for PostgreSQL with Entra ID auth: the app uses DefaultAzureCredential to get a token for the database; the DB has a user mapped to the managed identity.
Pros and cons
| Pros | Cons |
|---|---|
| No password to store or rotate | Token refresh logic needed in the app/pool |
| Access controlled by IAM, fully audited | Connection rate limits for token-based auth |
| Revoke access by changing IAM | Not every database/engine supports it |
What to say in the interview
"With IAM or managed identity auth, the workload gets a short-lived token from the cloud using IRSA or workload identity and uses it as the DB password, so there are no static credentials. It's my preferred option where supported."