首页 > 解决方案 > Get Account ID from Account Alias (boto3)

问题描述

Provided with an AWS Account alias, I would like to convert it to an AWS Account ID. I don't think there is an API for this, as the IAM alias commands in boto3 are limited to create, delete and list, but I figured I would at least ask the community.

My use case is to allow a user to provide either an account alias or account ID to the sts.assume_role() call. If an account ID is specified, great, we can simply build a role_arn from that and pass it to the function call. If an account alias is provided, we need to first convert it to an account ID, then build the role_arn in the same fashion.

标签: amazon-web-servicesamazon-iam

解决方案


推荐阅读