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!

posta 3 anni fa4914 visualizzazioni
1 Risposta
0
Risposta accettata

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
con risposta 3 anni fa
profile picture
ESPERTO
verificato 10 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande