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!

asked 3 years ago4865 views
1 Answer
0
Accepted Answer

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
answered 3 years ago
profile picture
EXPERT
reviewed 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions