Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programatically get AWS RDS connection string

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

like image 653
Alex Carruthers Avatar asked Sep 14 '25 10:09

Alex Carruthers


1 Answers

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.

like image 60
spg Avatar answered Sep 17 '25 04:09

spg