title: aws sts get-session-token fails with profile
body: <p>I'm trying to get a session token in order to set environment variables in order to use a tool which uploads to S3 but doesn't directly support AWS profiles.</p>
  
  <pre><code>aws sts get-session-token --profile myprofile
  Enter MFA code for arn:aws:iam::1234567890:mfa/myid:
  
  An error occurred (AccessDenied) when calling the GetSessionToken operation: 
  Cannot call GetSessionToken with session credentials
  </code></pre>
  
  <p>Subsequent calls skip the MFA check, indicating that it passed ok.</p>
  
  <p>Running <code>get-session-token</code> without the <code>--profile</code> parameter works fine:</p>
  
  <pre><code>$ aws sts get-session-token
  {
      "Credentials": {
  ...
  </code></pre>
  
  <p>What could be going wrong? Am I even going about this the right way?</p>
  
  <p>The relevant part of my <code>~/.aws/config</code>:</p>
  
  <pre><code>[profile otherprofile]
  mfa_serial=arn:aws:iam::xxx:mfa/myid
  aws_access_key_id=xxx
  aws_secret_access_key=xxx
  
  [profile myprofile]
  source_profile=otherprofile
  region=ap-southeast-2
  role_arn=arn:aws:iam::xxx:role/owner
  mfa_serial=arn:aws:iam::xxx:mfa/myid
  </code></pre>