Skip to content

Organizations

AWS Organisation get only the account name from the account id

AWS Organisation get only the account name from the account id

import boto3

organizations = boto3.client('organizations')

organizations.describe_account(AccountId='123456789012')

account_name = organizations.describe_account(AccountId='123456789012')['Account']['Name']

print(account_name)
source: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/organizations.html#Organizations.Client.describe_account