rdsauth is a tool to generate an auth token used to connect to a db with IAM credentials.
https://github.com/kanmu/rdsauth/releases/latest
Usage: rdsauth <url> [flags]
Arguments:
<url> Database URL
Flags:
-h, --help Show help.
-e, --export Output as environment variable.
--version
$ MY_DB_HOST=database-1.cluster-abcdef012345.us-east-1.rds.amazonaws.com
$ $(rdsauth -e postgres://scott@$MY_DB_HOST)
$ psql -h $MY_DB_HOST -U scott
...
postgres=>
$ MY_DB_HOST=database-1.cluster-abcdef012345.us-east-1.rds.amazonaws.com
$ $(rdsauth -e mysql://scott@$MY_DB_HOST)
$ mysql -h $MY_DB_HOST -u scott --enable-cleartext-plugin
...
mysql>
$ dig +short cname my-db.example.com
database-1.cluster-abcdef012345.us-east-1.rds.amazonaws.com
$ $(rdsauth -e postgres://scott@my-db.example.com)
$ psql -h my-db.example.com -U scott
...
postgres=>