Connecting Kubernetes workloads to an AWS RDS instance with IAM authentication is simple in theory but complex in practice. Credentials must flow without hardcoding secrets. Connections must be secure. Pods must assume only the roles they need, and nothing more. Done right, you get zero static passwords, least privilege, and instant revocation when needed.
Start with Kubernetes Service Accounts mapped to IAM Roles using IRSA (IAM Roles for Service Accounts). This binds AWS permissions directly to workloads through Pod specs. In AWS, define an IAM Role with the rds-db:connect action for the target RDS resource. Attach a trust policy that allows the OIDC identity provider of your EKS cluster.
Inside Kubernetes, annotate the Service Account with the IAM Role ARN. Deploy your app pods using that Service Account. Your application code or client library can now request temporary IAM tokens from the AWS SDK. These tokens are passed during the database connection handshake, replacing static PostgreSQL or MySQL passwords with short-lived credentials that AWS RDS validates.