The database was ready. The service was deployed. But the login failed.
Connecting Cloud Foundry apps to AWS RDS with IAM authentication looks simple on paper. In practice, it is a sequence of precise moves. One wrong setting, and the connection dies. Done right, you get a secure, passwordless link between your app and your database, fully integrated with AWS identity controls.
First, your RDS instance must support IAM authentication. This means enabling --enable-iam-database-authentication when you create the instance, or toggling it afterwards through the AWS Console or CLI. For MySQL or PostgreSQL, ensure you are running supported versions.
Next, configure your RDS security group to accept traffic from the network where your Cloud Foundry app runs. If using AWS VPC Peering or a direct link via AWS PrivateLink, confirm your routes and DNS resolution. A mismatch here adds hours of debugging.
Then, grant your IAM role the permissions to connect. At minimum, the policy rds-db:connect for the ARN of your DB resource is required. This is separate from the admin AWS policies you might already have. Without it, IAM token generation works, but authentication fails silently.