title: AWS Console - Find and remove unused IAM roles
body: <p>I have been messing around Amazon Web Services(AWS) with one single account for quite a while. I created and removed several EC2 instances, Lamdbda functions, NAT gateways etc.</p>
  
  <p>Through all those, I created too many new roles and now, after settling down the stuff I ended up with a garbage of IAM roles -there are many of them.</p>
  
  <p>To clean up, I want to <strong>find the roles that are not attached to any kind of item, resource or user (or idle for a period maybe, etc.) and remove them</strong>.</p>
  
  <p>I searched the net but generally there are <a href="https://aws.amazon.com/blogs/security/remove-unnecessary-permissions-in-your-iam-policies-by-using-service-last-accessed-data/" rel="nofollow noreferrer">docs</a> to reduce permissions of a particular role, which's fine but not the thing I want.</p>