what aws-cli command should i execute to list all IAM users whose account had last activity more than 180 days ago.
Basically we have to filter all those resources so that we can delete their accounts later
See How to find unused credentials.
Specifically with the awscli, use a combination of:
aws iam list-access-keys to get information about the access keys for a given user
aws iam get-access-key-last-used to see when a given access key was last used
Check the script I wrote for the purpose for 90 days. You can change the parameter to 180 days and run it. Additionally, you would need to pass the AWS profile parameter from the ~/.aws/credentials file. IAM_Access_Keyage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With