Created
March 10, 2015 21:41
-
-
Save adamar/1f2a0fba61b7976c4044 to your computer and use it in GitHub Desktop.
View details of a set of AWS IAM Keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# | |
# This script takes a set of boto credential stored | |
# in a profile stanza and returns some account and user details | |
# | |
# [profile unknown] | |
# aws_access_key_id = AKIABLAHBLAH | |
# aws_secret_access_key = SUCHSECRETUUUUHHHHH | |
# | |
# | |
# | |
import boto.iam | |
import os | |
conn_iam = boto.iam.connect_to_region('universal', profile_name="unknown") | |
usr = conn_iam.get_user() | |
acc = conn_iam.get_account_alias() | |
print "User ID: " + str(usr.user_id) | |
print "User ARN: " + str(usr.arn) | |
print "User Credentials Last Used: " + str(usr.password_last_used) | |
print "User Creation Date: " + str(usr.create_date) | |
for item in acc.account_aliases: | |
print "Account Alias: " + str(item) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment