AWS Organizations - list accounts for role [boto3]

0

Hi,

We are planning to support for AWS Organizations in our product. We will need to retrieve very often the list of AWS accounts belonging to a given organization. Instead of frequently traversing the organization tree to discover new/deleted accounts (it may be slow), I wonder if there is any boto3 binding or api endpoint to list all organization accounts (and ideally filter by role). Thanks in advance.

Regards

Roberto
gefragt vor 5 Monaten202 Aufrufe
1 Antwort
1
Akzeptierte Antwort

Hello.

You can get a list of accounts in Organizations by using list_accounts() described in the following document.
However, this cannot display a list of accounts across organizations, so if you want to cross organizations, you will need to set up cross-account roles, etc.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/organizations/client/list_accounts.html

I think list_children() can be used to list by OU.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/organizations/client/list_children.html

profile picture
EXPERTE
beantwortet vor 5 Monaten
profile pictureAWS
EXPERTE
überprüft vor 5 Monaten
  • Thank you @Riku - I wonder how the heck I went over this endpoint without noticing... Thanks!

    to list by OU I have found list_accounts_for_parent()

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