title: getting the current user account-id in boto3
body: <p>I need to get the <a href="http://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html" rel="noreferrer">account-id</a> of the 'current user' in a <a href="http://boto3.readthedocs.org/en/latest/index.html" rel="noreferrer"><code>boto3</code></a> script. Up to now my best solution is to parse the current user <a href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-arns" rel="noreferrer">arn</a>:</p>
  
  <pre><code>&gt;&gt;&gt; import boto3
  &gt;&gt;&gt; account_id = boto3.resource('iam').CurrentUser().arn.split(':')[4]
  </code></pre>
  
  <p>but I was wondering if there is a more 'lightweight' approach. In fact</p>
  
  <pre><code>&gt;&gt;&gt; timeit.timeit("boto3.resource('iam').CurrentUser().arn",
  ... 'import boto3', number=10)
  4.8895583080002325
  </code></pre>
  
  <p>and I actually do not need the <a href="https://boto3.readthedocs.org/en/latest/reference/services/iam.html#currentuser" rel="noreferrer"><code>CurrentUser</code></a> resource in my script.</p>