From 82ae5f6f915def1e6b3e0d8792066e402c94e9ab Mon Sep 17 00:00:00 2001 From: Doug Coker Date: Mon, 26 Aug 2019 22:00:10 -0700 Subject: [PATCH] fix --rotate-identity-keys to work with upgraded boto SDKs --- awsmfa/__main__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awsmfa/__main__.py b/awsmfa/__main__.py index 9709654..207d10e 100755 --- a/awsmfa/__main__.py +++ b/awsmfa/__main__.py @@ -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,