Coder Perfect

How Do I Delete AWS Configure Credentials?

Problem

In sudo nano /.aws/config, I erased the AWS credentials. The credentials, however, remain in aws configure. Is there a way to reset aws configure with clear state?

Asked by ebertbm

Solution #1

Simply delete /.aws/credentials and /.aws/config.

EDIT: Please note that the path refers to the user’s home directory and is unique to each user in the system.

Answered by pavan

Solution #2

If you’ve made numerous profiles, don’t remove the files since you’ll lose them all if you do! Unless that’s what you’re looking for:)

Go to each of the files one by one –

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

Remove only the section profiles you wish to get rid of. 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

If that’s what you want, simply delete the entries corresponding to the user2 profile. You should also give the profile you’re configuring a name –

aws configure --profile user2

Otherwise, [default] will be used.

http://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html for more information.

Answered by Aniket Thakur

Solution #3

For Mac users, here is a graphical presentation.

Answered by Kirtikumar A.

Solution #4

I’m not sure if this clears the credentials, but I was able to replace them by rerunning aws configure and providing new credentials. By typing aws configure —newusername, I was also able to create several profiles and run a future command with that user by appending —profile newusername. This is a good tutorial: https://www.crybit.com/configure-iam-user-on-your-linux-machine/

Answered by Jeffrey Kozik

Post is based on https://stackoverflow.com/questions/46319880/how-do-i-clear-the-credentials-in-aws-configure