How to know if an AWS IAM role is actually being used

There currently is no method using SDKs for the AWS CLI to get the last accessed time of an IAM role. I confirmed this today with AWS support.

Currently, the only way is to use the AWS Management Console.

  1. Select your IAM role
  2. Click the "Access Advisor" tab.
  3. The contents of this tab will display the last access time for each of the various services (S3, EC2, etc.)