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 configure --profile "profilename" prompts "The config profile (profilename) could not be found" #4626

Closed
BruceWangNo1 opened this issue Nov 7, 2019 · 14 comments
Assignees
Labels
bug This issue is a bug. configuration

Comments

@BruceWangNo1
Copy link

BruceWangNo1 commented Nov 7, 2019

aws --version

aws-cli/1.16.276 Python/2.7.14 Darwin/18.0.0 botocore/1.13.12

According to https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration-multi-profiles , this configure command should work. However, error message reads: "The config profile (profilename) could not be found"

Temporary fix:

vim ~/.aws/config

and add "[profilename]" and then rerun the configure command

@BruceWangNo1 BruceWangNo1 changed the title aws configure --profile "profilename" prompts "The config profile (aws-s3) could not be found" aws configure --profile "profilename" prompts "The config profile (profilename) could not be found" Nov 7, 2019
@bisdavid
Copy link
Contributor

bisdavid commented Nov 7, 2019

@BruceWangNo1, I'm sorry but I can't repro your problem. The aws configure --profile _newprofilename_ command works the way I documented it on that page. I just ran the following, and "junk" did NOT exist in there before I did ran these commands.

[~] $ aws --version
aws-cli/1.16.273 Python/2.7.16 Darwin/18.7.0 botocore/1.13.9

[~] $ aws configure --profile junk
AWS Access Key ID [None]: 12345
AWS Secret Access Key [None]: 12345
Default region name [None]: us-west-2
Default output format [None]: json

[~] $ cat ~/.aws/credentials
[junk]
aws_access_key_id = 12345
aws_secret_access_key = 12345

[~] $ cat ~/.aws/config
[profile junk]
output = json
region = us-west-2
'''

@BruceWangNo1
Copy link
Author

@bisdavid Thank you for your help. Probably not worth the effort to dive into this. I got a temporary fix anyway.

@steve-estes
Copy link

For the record, I'm getting the same thing too - instead of preparing to write the profile, it looks like aws configure --profile <newprofilename> is trying to read it first or something. Or maybe even just a Python 2 vs Python 3 thing?

As documented here.

And yes, we can work around it by manually editing the config files, but there's a reason we have this CLI command.

Stephens-MacBook-Pro:.aws steve$ aws --version
aws-cli/1.18.28 Python/2.7.15 Darwin/19.3.0 botocore/1.15.28
Stephens-MacBook-Pro:.aws steve$ more config
[default]
region = us-east-2
output = json
[plugins]
endpoint = awscli_plugin_endpoint
Stephens-MacBook-Pro:.aws steve$ more credentials 
[default]
aws_access_key_id = <mykey>
aws_secret_access_key = <snip>
Stephens-MacBook-Pro:.aws steve$ aws configure --profile wasabi

The config profile (wasabi) could not be found
Stephens-MacBook-Pro:.aws steve$ 

@lavignes
Copy link

lavignes commented Apr 8, 2020

I am also able to repro this

lavignes@hostname ~ %aws --version
aws-cli/1.18.38 Python/3.6.9 Linux/5.3.0-46-generic botocore/1.15.38
lavignes@hostname ~ %aws configure --profile test

The config profile (test) could not be found

@dfezzie
Copy link

dfezzie commented Apr 8, 2020

I can reproduce this as well:

dfezzie@hostname ~> aws --version
aws-cli/1.18.14 Python/3.7.6 Darwin/18.7.0 botocore/1.15.14
dfezzie@hostname ~> aws configure --profile test

The config profile (test) could not be found

@KaibaLopez
Copy link
Contributor

@lavignes @steve-estes and @dfezzie ,
Can you try upgrading to V2, it looks to me like this problem doesn't happen anymore on the newest version of the SDK.

@KaibaLopez KaibaLopez self-assigned this Apr 8, 2020
@KaibaLopez KaibaLopez added the guidance Question that needs advice or information. label Apr 8, 2020
@gareth-e
Copy link

I also seem to get this - but only if the AWS_PROFILE environment variable is also set (to a profile that does not yet exist). If I then unset this var then the aws configure set.... command works fine.

I noticed it when I ran the command aws configure set ... --profile AAA but got the error "The config profile (BBB) could not be found", which was strange.
On closer inspection, the AWS_PROFILE var was set to "BBB" but that profile did not yet exist!

Hope that helps...

@KaibaLopez
Copy link
Contributor

Ah I see, thanks @ch-gareth !

so if you have a $AWS_PROFILE set it won't let you configure a new profile through aws configure --profile, hmm I'll mark this as a bug then, that should not be the behavior.

@KaibaLopez KaibaLopez added bug This issue is a bug. and removed guidance Question that needs advice or information. labels Apr 23, 2020
@KaibaLopez KaibaLopez assigned joguSD and unassigned KaibaLopez Apr 23, 2020
@gareth-e
Copy link

Hmmm, sort of. If $AWS_PROFILE is set to a profile that exists / is defined then it seems OK for me. It just throws an error if that var is set to a profile which isn't configured (yet). Which makes sense really from that error message.
In my case, I was wanting to configure a new profile, but $AWS_PROFILE was already set to the name of that new profile. That's what threw me for a while and was causing me the error above (and what brought me to this page!).
Could be these others here were having the same issue. I suspect the original message workaround "vim ~/.aws/config ...add "[profilename]" and then rerun the configure command" probably would also have worked for me too.
Perhaps the aws configure set ...... --profile profile-name command could create a section for profile-name if it doesn't yet exist?

@lavignes
Copy link

@ch-gareth for me I don't have the AWS_PROFILE environment variable set and this still repros.

Perhaps the aws configure set ...... --profile profile-name command could create a section for profile-name if it doesn't yet exist?

I'm 99% sure that is the bug here. It is supposed to do that.

@gareth-e
Copy link

Hi @lavignes & @KaibaLopez. Yes, I see.
Interesting that it will create a new config section for me (I've just discovered) - but not if I have AWS_PROFILE set to a name that isn't already in the config. Seems to just come down to that env var in my case. I can set it to a profile that exists or unset it and the command will create a new profile OK.
In case it helps, my versions are:
aws-cli/2.0.8 Python/3.7.3 Linux/4.9.125-linuxkit botocore/2.0.0dev12
Hope that's useful! 🤞

@DukeCaboom
Copy link

Thanks @ch-gareth I encountered this for aws-cli/1.16.115 Python/3.7.5 Darwin/17.7.0 botocore/1.12.105
and upgraded it to aws-cli/2.0.10 Python/3.7.4 Darwin/17.7.0 botocore/2.0.0dev14.

@stobrien89
Copy link
Member

Confirmed that issue no longer exists as initially described in v1 or v2. Closing for now, but please feel free to @ me if anyone is still having problems!

@github-actions
Copy link

github-actions bot commented Mar 6, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. configuration
Projects
None yet
Development

No branches or pull requests

10 participants