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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则