Skip to content

Commit

Permalink
fix --rotate-identity-keys to work with upgraded boto SDKs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoker committed Aug 27, 2019
1 parent 74dc301 commit 82ae5f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions awsmfa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ def rotate(args, credentials):
current_access_key = next((key for key
in iam.CurrentUser().access_keys.all()
if key.access_key_id == current_access_key_id))
current_access_key.delete()

# create the new access key pair
iam_service = session3.client('iam')

# delete existing access key and create new one
iam_service.delete_access_key(AccessKeyId=current_access_key.access_key_id)
new_access_key_pair = iam_service.create_access_key()["AccessKey"]

print("Rotating from %s to %s." % (current_access_key.access_key_id,
Expand Down

0 comments on commit 82ae5f6

Please sign in to comment.