Difference between revisions of "Aws sts get-caller-identity"

From wikieduonline
Jump to navigation Jump to search
Line 13: Line 13:
 
  {
 
  {
 
     "UserId": "ZIDBZCTGOUKVXXFNQ5Q3F",
 
     "UserId": "ZIDBZCTGOUKVXXFNQ5Q3F",
     "[[Account]]": "894058868389",
+
     "[[Account]]": "09876543212",
     "Arn": "arn:aws:iam::894058868389:user/your_user"
+
     "Arn": "arn:aws:iam::09876543212:user/your_user"
 +
}
 +
 
 +
{
 +
    "UserId": "AROASTNMATSFIGC3RFZFC:martin.oscar",
 +
    "Account": "09876543212",
 +
    "Arn": "arn:aws:sts::09876543212:[[assumed-role]]/AWSReservedSSO_AdministratorAccess_111111111/your-username"
 
  }
 
  }
  

Revision as of 14:07, 2 September 2022

The aws sts get-caller-identity command outputs three pieces of information including the ARN.


ACCOUNT_ID=$(aws sts get-caller-identity --output text --query 'Account')

aws sts get-caller-identity


aws sts get-caller-identity
{
    "UserId": "ZIDBZCTGOUKVXXFNQ5Q3F",
    "Account": "09876543212",
    "Arn": "arn:aws:iam::09876543212:user/your_user"
}
{
    "UserId": "AROASTNMATSFIGC3RFZFC:martin.oscar",
    "Account": "09876543212",
    "Arn": "arn:aws:sts::09876543212:assumed-role/AWSReservedSSO_AdministratorAccess_111111111/your-username"
}

Related

sts:AssumeRole

See also

Advertising: