c# - Return the date of last activity for an AWS Access Key -
i'm running audit gather information iam users , keys across our aws accounts. have following code gather keys:
amazonidentitymanagementserviceclient iam = new amazonidentitymanagementserviceclient(accesskey, secretkey); listusersrequest userreq = new listusersrequest(); listusersresponse userres = iam.listusers(userreq); foreach (user user in userres.users) { listaccesskeysrequest keyreq = new listaccesskeysrequest { username = user.username }; listaccesskeysresponse keyres = iam.listaccesskeys(keyreq); foreach (accesskeymetadata key in keyres.accesskeymetadata) { // store these values // key.accesskeyid // key.username // key.createdate // key.status } }
one metric grab date key last used. way can determine keys can removed accounts while making sure key isn't being used. there api or call can make information?
Comments
Post a Comment