aws sts get-caller-identity

The AWS CLI command that prints which account and identity your current credentials belong to.

In more detail

Run it first when a permission error appears: a perfectly written policy on the wrong identity still produces a refusal. It changes nothing, costs nothing and needs no permissions. Avoid showing its full output on screen, because an ARN reveals your account number.

Example

aws sts get-caller-identity --query Arn --output text

Related terms

Taught in

References