Is there a way through the aws api to get the connection string for a RDS database? Something in the form of:
postgres://username:password@host/db_name
No there's no API call that will build that string for you.
However, using the DescribeDBInstances API call you can retrieve the MasterUsername
, DBName
("the name of the initial database of this instance that was provided at create time, if one was specified when the DB instance was created") and host (through the Endpoint.Address
field) and build the string yourself.
For the password, you'll have to provide it yourself in a secure manner, since RDS cannot retrieve it through API calls.