Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am somuchtogrok on github.
  • I am zachwolf (https://keybase.io/zachwolf) on keybase.
  • I have a public key whose fingerprint is 6682 4754 29F2 1BA3 6BEC 8D02 EE94 C707 2224 27AA

To claim this, I am signing this object:

@SoMuchToGrok
SoMuchToGrok / vault-token-cleanup.py
Created September 25, 2017 14:54
Deletes up all AWS users starting with 'vault-token' who have not used their access key in >= 3 days
import boto3
from datetime import datetime, timedelta
def delete_user(user):
print('Deleting user: %s' % user.user_name)
for key in user.access_keys.all():
key.delete()
for policy in user.policies.all():
client.delete_user_policy(UserName=user.user_name,
PolicyName=policy.policy_name)
for group in user.groups.all():