Getting Current IAM Role

To get the current IAM role, use the get-caller-identity command:

aws sts get-caller-identity

This returns a response like the following:

{
 
    "UserId": "user-id",
    "Account": "aws-account-id",
    "Arn": "sts-role-arn"
}