title: What is the aws command to verify my login credentials are correct? AKA whoami for aws-cli
body: <h1>TLDR</h1>
  <p>What is the aws-cli command to verify my login credentials are correct?<br />
  What is the <code>whoami</code> equivalent for the aws-cli?</p>
  <h1>Description of problem</h1>
  <p>I'm learning AWS technologies including serverless and using different accounts when working with different teams.  I sometimes get errors that are due to using the wrong credentials or not having the permission to do something.</p>
  <p>When I run into an error, the first thing I want to do is make sure I'm using the correct credentials, so I want a <code>whoami</code> command.  So:</p>
  <ol>
  <li><p>I want to know that my AWS credentials are valid,</p>
  </li>
  <li><p>What my AWS IAM login is.  The equivalent of <code>whoami</code> in Windows or
  Unix.  Obviously, if it just gives me who I am I know I'm valid!</p>
  </li>
  <li><p>What the rights are for the IAM user I'm logged in as.  The IAM roles or permissions this IAM user has.  See also <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html" rel="noreferrer">Roles terms and concepts</a></p>
  </li>
  </ol>
  <h1>What I've tried</h1>
  <p>So I've searched and found:</p>
  <p><a href="https://stackoverflow.com/questions/51968478/verifying-aws-command-line-interface-credentials-are-configured-correctly">Verifying AWS Command Line Interface credentials are configured correctly</a> - which again is similar.  It has a link to named profiles which helps by giving me a command that should work <code>aws ec2 describe-instances</code> which works, and fills #1 from above list.</p>
  <p>More searches give</p>
  <ul>
  <li><a href="https://aws.amazon.com/premiumsupport/knowledge-center/troubleshoot-cli-errors/" rel="noreferrer">Why am I receiving errors when running AWS CLI commands?</a></li>
  </ul>
  <p>Leads me to: <a href="https://aws.amazon.com/premiumsupport/knowledge-center/ec2-not-auth-launch/" rel="noreferrer">Why am I receiving the error message &quot;You are not authorized to perform this operation&quot; when I try to launch an EC2 instance?</a> - which I think could help me and answer this question but when I try the command:</p>
  <pre><code>aws --version
  aws-cli/2.1.29 Python/3.8.8 Windows/10 exe/AMD64 prompt/off
  
  aws sts decode-authorization-message --encoded-message encoded-message
  
  An error occurred (InvalidAuthorizationMessageException) when calling the DecodeAuthorizationMessage operation: Message is not valid
  </code></pre>
  <p>Another link:
  <a href="https://aws.amazon.com/premiumsupport/knowledge-center/troubleshoot-aws-cli-commands-ec2/" rel="noreferrer">Why can't I run AWS CLI commands on my EC2 instance?</a></p>
  <p>which leads me back to a previous link...</p>
  <p>I'm guessing that this is a simple request and has a simple answer.  Please share it.  Thanks.</p>