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!

質問済み 3年前4914ビュー
1回答
0
承認された回答

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
回答済み 3年前
profile picture
エキスパート
レビュー済み 10ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ