DEV Community

KALPESH
KALPESH

Posted on

AWS CLI Basics: A Beginner’s Tutorial

Install AWS CLI

Download and Install it from the official AWS CLI installation guide.

Run aws configure

$ aws configure

aws configure --profile myprofile
AWS Access Key ID [None]: YOUR_ACCESS_KEY_ID
AWS Secret Access Key [None]: YOUR_SECRET_ACCESS_KEY
Default region name [None]: us-west-2
Default output format [None]: json
Enter fullscreen mode Exit fullscreen mode

Verify Configuration

aws configure list
Enter fullscreen mode Exit fullscreen mode

Configuration Files

AWS configure command stores your credentials & configuration settings in two files located in the ~/.aws directory:

  • ~/.aws/credentials: Stores your AWS access key ID and secret access.

  • key.~/.aws/config: Stores your default region and output format.

Remove Credentials from Configuration File

Manually remove the credentials from the configuration file

  • Open the ~/.aws/credentials file (on Unix-based systems) or C:\Users\USERNAME.aws\credentials (on Windows).

  • Delete the [default] section or any other named profile section that contains your credentials.

Unset Environment Variables

If you have set your AWS credentials using environment variables, you can unset them:

unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
Enter fullscreen mode Exit fullscreen mode

Delete AWS CLI Cache

rm -rf ~/.aws/cli/cache
Enter fullscreen mode Exit fullscreen mode

Feel free to share and spread the knowledge! 🌟😊 Enjoy Learning! 😊

Top comments (0)