'How Do I Clear The Credentials In AWS Configure?

I have deleted the AWS credentials in sudo nano ~/.aws/config. But, the credentials are still in aws configure. Is there a way to reset aws configure with clear state?



Solution 1:[1]

just remove ~/.aws/credentials along with ~/.aws/config

EDIT: Note path references user home directory and specific to each user in system.

Solution 2:[2]

Do not delete the files if you have multiple profiles created as all will be lost if you delete these files! unless thats what you want :)

Go to each of the file -

 - ~/.aws/credentials
 - ~/.aws/config

and remove just the part profiles you want to delete. Eg.

~/.aws/credentials

[default]
aws_access_key_id=yourAccessKeyId
aws_secret_access_key=yourSecretAccessKey

[user2]
aws_access_key_id=yourAccessKeyId
aws_secret_access_key=yourSecretAccessKey

and

~/.aws/config

[default]
region=us-west-2
output=json

[profile user2]
region=us-east-1
output=text

Just delete entries corresponding to user2 profile if thats what you want. And you should also give a profile name to profile you configure -

aws configure --profile user2

Else it will just be [default]

More details - http://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html

Solution 3:[3]

Here is the graphical presentation for mac user Graphical

Solution 4:[4]

Not sure if this clears the credentials but I was able to simply change the credentials by running aws configure again and entering in new credentials. I was also able to make multiple profiles by running aws configure --newusername and I could run a future command with that user by appending --profile newusername. Good tutorial here: https://www.crybit.com/configure-iam-user-on-your-linux-machine/

Solution 5:[5]

Maybe just a Windows thing but if you edit the ~.\aws\config and ~.\aws\credentials files like is suggested by Aniket Thakur, you might run into an issue where aws configure complains about a profile you deleted not being available. This seems to be because the AWS_PROFILE environment variable is referencing that profile. Unset that variable and you should be back in business.

Tried to comment under his answer but I don't have enough points (on this account).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Steven K7FAQ
Solution 2
Solution 3 Kirtikumar A.
Solution 4 Jeffrey Kozik
Solution 5 dbrouwer2