As a developer or administrator working with AWS Organizations, you may often need to figure out which AWS account belongs to which Organizational Unit (OU). How to filter AWS Accounts by Organizational Unit Name
Finally, the script calls the AWS Organizations API again, this time using the collected OU IDs to list the accounts associated with each OU.
The script will output the AWS account IDs and their aliases/names for each Organizational Unit you provided as input. By harnessing the power of Boto3 and the AWS Organizations API, the script in this blog post effectively bridges the gap left by AWS’s native functionality, allowing you to find and list AWS accounts based on their human-readable OU names rather than the less intuitive OU IDs.