AWS is a bit too rich in features.
Log out of AWS CLI:
Somehow I didn’t find a normal way, but removing the credential file sure worked:
$ rm ~/.aws/config
$ rm ~/.aws/credentials
Log in to AWS CLI:
$ aws configure
Then fill in the prompts for the following 4:
AWS Access Key ID [****]:
AWS Secret Access Key [****]:
Default region name [us-west-1]: depending on where your repos are
Default output format [None]: can leave as default empty
Access key can be acquired here:
And when the time comes to docker push, to refresh the users, don’t forget the aws erc login, which looks like:
$(aws ecr get-login --no-include-email --region us-east-1)
Well if you have mfa confiigured, just enter a wrong mfa token while logging in and that will mean you will no longer remain logged in [which means you are logged out :-)]