简体   繁体   中英

I want to delete IAM users with a script which have a prefix "vault-" to them and are older than 2 days

How do I list IAM users with aws cli which are older than 2 days and a prefix attached to them?

aws iam list-users | jq '.Users[] | select ( .CreateDate | contains("2019-10-10") ) | select ( .UserName | startswith("vault-") ) | .UserId'

and then you can loop over results to delete the user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM