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 textRelated terms
- AWS STS — The AWS Security Token Service, which issues temporary credentials when someone assumes a role.
- ARN — Amazon Resource Name: the unique identifier of any AWS resource, such as arn:aws:iam::123456789012:role/github-deploy.
- AWS CLI — Amazon's command-line tool for calling AWS services from a terminal or script.
Taught in
- IAM as the Foundation — Cloud Infrastructure & Hyperscaler Architecture
- The Danger of Long-Lived Keys — Cloud Infrastructure & Hyperscaler Architecture
- Policy Simulation and Dry Runs — Cloud Infrastructure & Hyperscaler Architecture
- The Console versus the CLI — Cloud Infrastructure & Hyperscaler Architecture