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
질문됨 5달 전205회 조회
1개 답변
2
수락된 답변

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
전문가
답변함 5달 전
profile picture
전문가
검토됨 15시간 전
profile pictureAWS
전문가
검토됨 5달 전
  • 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()

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠