我有 AWS 密钥和秘密密钥,想致电
boto
获取账户名称。
我可以获得账户 ID,但 AWS 账户名称是个谜。
要在
boto3
中获取 AWS 账户别名:
alias = boto3.client('iam').list_account_aliases()['AccountAliases'][0]
organizations
服务获取帐户名那样多的访问权限。
id = boto3.client('sts').get_caller_identity().get('Account')