The terminal waits, the cursor blinks, and you’re about to connect lnav directly to AWS RDS with IAM authentication—securely, without a single password stored.
AWS RDS supports IAM database authentication for MySQL and PostgreSQL. It replaces static passwords with short‑lived tokens, generated via AWS CLI or SDK, and verified by the database engine. This means better security posture, no credential rotation scripts, and IAM policies controlling who can connect.
lnav is a powerful, interactive log file navigator that can query live database logs as if they were local files. When you combine lnav with AWS RDS IAM authentication, you can inspect query execution, performance bottlenecks, and error logs without leaving your shell—while keeping access locked down to authorized IAM principals.
To connect lnav to AWS RDS via IAM, follow these steps:
- Enable IAM authentication for your RDS instance. In the AWS console or CLI, set
--enable-iam-db-authentication. - Configure RDS security groups to allow inbound traffic from your IP or VPC security group.
- Assign IAM policies such as
rds-db:connectwith the correct DB resource ARN.
Connect with lnav by using the token as the password in your connection string: