Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Cli v2 You must specify a region #3772

Closed
lakhera2014 opened this issue Dec 1, 2018 · 4 comments
Closed

AWS Cli v2 You must specify a region #3772

lakhera2014 opened this issue Dec 1, 2018 · 4 comments
Labels
closed-for-staleness feature-request A feature should be added or improved. v2

Comments

@lakhera2014
Copy link

Steps to reproduce the issue

AWS CLI Import Command run sucessfully
$ aws configure import --csv file:///Users/XYZ/Downloads/credentials.csv
Successfully imported 1 profile(s)

Profile mytestiamuser listed sucessfully
$ aws configure list-profiles
default
mytestiamuser

But when I try to run any command, it's failing due to below error? This is supposed to pick default region?

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

$ aws configure --profile mytestiamuser
AWS Access Key ID [****************XXXXX]:
AWS Secret Access Key [****************XXXX]:
Default region name [None]:
Default output format [None]:

$ cat ~/.aws/config
[default]
region = us-west-2

@lakhera2014
Copy link
Author

After manually configuring the region, it's working as expected

$ aws configure --profile mytestiamuser
AWS Access Key ID [****************XXXX]:
AWS Secret Access Key [****************XXX]:
Default region name [None]: us-west-2
Default output format [None]:

$ aws ec2 describe-regions --profile mytestiamuser
{
"Regions": [
{
"Endpoint": "ec2.ap-south-1.amazonaws.com",
"RegionName": "ap-south-1"
},
So look like aws cli v2 is not picking the default region?

@JordonPhillips
Copy link
Member

To be clear, the cli does not take values from the default profile if they are not present in the profile you are using. If you set the AWS_DEFAULT_REGION environment variable, that will be used regardless of profile.

I think it would be reasonable to offer some way for the import command to set regions, either by having --region set the region for all imported profiles or asking for each. We should probably also put a warning in the output if you don't do that.

@JordonPhillips JordonPhillips added feature-request A feature should be added or improved. v2 labels Dec 10, 2018
@mike-whittaker-work
Copy link

So you can always set the environment variable as part of the command, eg.:

AWS_DEFAULT_REGION=eu-west-1 aws xxxxx

@github-actions
Copy link

Greetings! It looks like this issue hasn’t been active in longer than one year. We encourage you to check if this is still an issue in the latest release. Because it has been longer than one year since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment to prevent automatic closure, or if the issue is already closed, please feel free to reopen it.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness feature-request A feature should be added or improved. v2
Projects
None yet
Development

No branches or pull requests

3 participants