Interview Prep/AWS/Global Infrastructure and IAM Basics

What does `aws sts get-caller-identity` return and why is it the first command you run?

BeginnerConceptGlobal Infrastructure and IAM Basics
Answer

It returns the UserId, Account and Arn of the credentials the CLI is currently using. It needs no IAM permission, so it never fails for authorization reasons, which makes it the universal "who am I and in which account" check.

$ aws sts get-caller-identity
{"UserId":"AROAEXAMPLE:alice","Account":"123456789012",
 "Arn":"arn:aws:sts::123456789012:assumed-role/Admin/alice"}

An assumed-role ARN means temporary credentials; a bare user/ ARN means long-lived keys.

aws All AWS questions Roadmap: AWS core services

More on Global Infrastructure and IAM Basics