Aws CLI credentials and configuration settings (Keys)

For AWS CLI credentials , there are different ways that aws cli will find for credentials.
Based on this link, There are 6 ways in total for now, who knows future there will be more secured way to using CLI.

For this example , i will talk about how to import keys but using the basic ways and after that how to modify and adding more profile to the credentials.

Setting up two profile 1st is for default and second is another user

$ aws configure 
AWS Access Key ID [None]: YOUR_AWS_ACCESS_KEY_ID
AWS Secret Access Key [None]: YOUR_AWS_SECRET_ACCESS_KEY
Default region name [None]: us-east-1
Default output format [None]: text

$ aws configure --profile user2
AWS Access Key ID [None]: YOUR_AWS_ACCESS_KEY_ID
AWS Secret Access Key [None]: YOUR_AWS_SECRET_ACCESS_KEY
Default region name [None]: us-east-1
Default output format [None]: text

For output format there are three kind of choice:-

  • JSON (json)
  • Tab-delimited text (text)
  • ASCII-formatted table (table)

You can simply change the data such as key’s and region in files located ~/.aws/
You can just run aws cli with different profile by type –profile profile2-name.Besides, if you would like to constantly used profile2 as your main profile, you can either change it in ~/.aws/ or your can export an Enviroment variable like this export AWS_PROFILE=profile2-name

You may also like...