Account ID fix

Altered call method so getting the account ID works with sts, which is needed for various authentication methods.
This commit is contained in:
Rich Mogull
2018-05-24 16:44:39 -07:00
parent cacd572e2c
commit c2047194f5

View File

@@ -37,9 +37,10 @@ def controller(access, secret, profile):
sys.exit() sys.exit()
# pull the account ID for use when needed for filtering # pull the account ID for use when needed for filtering
iam = session.resource('iam') iam = session.client('sts')
account_id = iam.CurrentUser().arn.split(':')[4] # account_id = iam.CurrentUser().arn.split(':')[4]
account_id = iam.get_caller_identity()["Account"]
click.echo('Current account ID: ' + account_id) click.echo('Current account ID: ' + account_id)
# Initialize dictionary to hold the counts. Pull the regions using EC2, since that is in every region. # Initialize dictionary to hold the counts. Pull the regions using EC2, since that is in every region.