简体   繁体   中英

aws cli not honouring default region configuration

I have the default region set in ~/.aws/config file:

[default]
region=us-west-2

However, when I try describe-instances command for some specific profile it is failing with the following message:

$ aws ec2 describe-instances --profile my_profile
You must specify a region. You can also configure your region by running "aws configure".

Shouldn't it used the default profile configured in ~/.aws/config file? What am I missing here?

Output of aws configure list :

      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key     ******************** shared-credentials-file
secret_key     ******************** shared-credentials-file
    region                us-west-2      config-file    ~/.aws/config

Output of aws configure list --profile my_profile

      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                my_profile           manual    --profile
access_key     ******************** shared-credentials-file
secret_key     ******************** shared-credentials-file
    region                <not set>             None    None

ps new to AWS. pardon me if this is a very basic question.

You are using named profiles , by default default profile is used. Just like you configure default, you can/need to configure your profile.

aws configure --profile my_profile

It will prompt you to fill access key , secret access key , AWS Region , and output format as it is stated here

You can create additional configurations that you can refer to with a name by specifying the --profile option and assigning a name. The following example creates a profile named produser. You can specify credentials from a completely different account and Region than the other profiles.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM