Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

script to remove student accounts

  • Loading branch information...
commit 4b1858c69e9d6241be17ab72cfd7dfc110a62d9e 1 parent 64aafc7
@marcua marcua authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 resources/inst/remove_iam_accounts.py
View
22 resources/inst/remove_iam_accounts.py
@@ -0,0 +1,22 @@
+from aws_private_settings import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
+
+import base64
+import boto
+import csv
+import os
+import sys
+
+reader = csv.DictReader(open(sys.argv[1], 'r'))
+iam = boto.connect_iam(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
+
+for line in reader:
+ username = line['username']
+ key_id = line['access_key_id']
+ try:
+ user = iam.delete_login_profile(username)
+ except:
+ pass
+ iam.remove_user_from_group("dataiap_students", username)
+ iam.delete_access_key(key_id, username)
+ iam.delete_user(username)
+

0 comments on commit 4b1858c

Please sign in to comment.
Something went wrong with that request. Please try again.