import boto3 iam = boto3.client('iam') user = iam.get_user() aws_account_id = user['User']['Arn'].split(':')[4] print(aws_account_id)
Recommended Posts