Last updated: Feb 26, 2024
Reading time·2 min
In order to clear your AWS CLI Credentials you have to:
credentials
and config
files. The path depends on your
operating system:# on Linux and macOS ~/.aws/credentials ~/.aws/config # on Windows C:\Users\USERNAME\.aws\credentials C:\Users\USERNAME\.aws\config
credentials
and config
files
in the following way:[default] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_ACCESS_KEY [admin] aws_access_key_id=YOUR_ACCESS_KEY_ID aws_secret_access_key=YOUR_SECRET_ACCESS_KEY
[default] region = us-east-1 output=json [profile admin] region=us-east-1 output=json
credentials
and
config
files, save the changes and the profile is removed from your
machine.credentials
and config
files contain a single profile, you can just delete the files to clear your AWS CLI credentials. The next time you run the aws configure
command, the AWS CLI will automatically re-create them for you.Be sure to delete any configuration referencing a profile from both files -
credentials
and config
.
The next time you need to add your AWS CLI credentials, run the aws configure
command to either add a profile to the list or re-create the config
and
credentials
files on your machine:
# For the Default profile aws configure # For a profile named admin aws configure --profile admin
The access and secret access keys will be stored in the credentials
file,
whereas the region and output format will be in the config
file.
The two files are located in the same directory.
You can learn more about the related topics by checking out the following tutorials: