How can I retrieve the list of all databases in an RDS DB instance via API?

0

Hi all,
Is there any way to retrieve the list of all databases (or at least database names) in an RDS DB instance via API or SDK?

The 'describe-db-instances' action doesn't serve my needs, as it contains only the "name of the initial database of this instance that was provided at create time"...

I would like to avoid triggering an SQL query and maximize API usage.

Thank you all!

gefragt vor 3 Jahren4914 Aufrufe
1 Antwort
0
Akzeptierte Antwort

It's not possible because each database engine has a different implementation of the database concept, so it's a subject that varies from engine to engine.

What you can do is to use the ExecuteStatement RDS API command https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_ExecuteStatement.html to run a select that queries the DB data dictionary for that specific engine for that RDS instance, and then you can get the database names.

It does not avoid to run the SQL, but it is a standardized way to get this info no matters the instance DB engine, as the result output has always the same structure.

Zacca
beantwortet vor 3 Jahren
profile picture
EXPERTE
überprüft vor 10 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen