python - Get AWS Account ID from Boto -
i have aws_access_key_id , aws_secret_key. these active credentials, belong active user, belongs aws account. how, using boto3, find id of aws account?
the accountid can grabbed get-caller-identity sts function. returns "account" field:
client = boto3.client("sts", aws_access_key_id=access_key, aws_secret_access_key=secret_key) account_id = client.get_caller_identity()["account"]
Comments
Post a Comment