DEV Community

Cover image for How to set and delete AWS CLI profile
Fabien Townsend
Fabien Townsend

Posted on

How to set and delete AWS CLI profile

In this article, I will briefly explain how to add an AWS profile to your AWS CLI and how to delete it.

How to add a profile

AWS Console

From the top right of your screen, click on Security credentials

AWS Console menu

Then scroll down to the Access keys and click on Create access key

AWS Console Access keys section

Then select Command Line Interface (cli), check the tick box, and click on Next

AWS Console creation step

After that, you will be asked to Description tag value which is optional, on the following page you will be provided with the Access key and Secret access key required for configure your CLI.

AWS Console aws cli access key and secret access key

Now we can pass to the CLI the required steps

CLI

You can start by typing the following command which will show you the current list of your AWS profile: aws configure list-profiles

You will now need to type the following command, where test is the name of the profile that you want
aws configure --profile test

AWS Access Key ID [None]: AKIA2INPZLWEZ2RAZ37Q
AWS Secret Access Key [None]: ****
Default region name [None]: eu-west-1
Default output format [None]: 
Enter fullscreen mode Exit fullscreen mode

Now if you type again aws configure list-profiles you will see you new profile.

How to delete a profile

AWS Console

From the Access keys section of the Security credentials page of your profile, you can click on Action > Delete and follow the steps described
AWS Console deletion cli profile

Now you have deleted the profile from your AWS Console, you can follow the steps for your CLI

CLI

You have two files in your system credentials and config, you can find them in the following path for MacOS:

~/.aws/credentials
~/.aws/config
Enter fullscreen mode Exit fullscreen mode

So in each of them, you will need to delete the related information to your profile which will be right below [test] where test is the name of your profile

Top comments (0)