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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -