简体   繁体   中英

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?

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

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

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

Here is the graphical presentation for mac user图形化

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/

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).

For windows users just open aws credentials file and update based on your requirements.

File is located in C:> Users > yourusername >.aws - credentials

All the best.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM