SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> import boto3
  2. >>> account_id = boto3.resource('iam').CurrentUser().arn.split(':')[4]
  3.      
  4. >>> timeit.timeit("boto3.resource('iam').CurrentUser().arn",
  5. ... 'import boto3', number=10)
  6. 4.8895583080002325
  7.      
  8. >>> import boto3
  9. >>> boto3.client('sts').get_caller_identity().get('Account')
  10. '012345678901'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top