Every time I want to config something with AWS I get the following error :
"The config profile (myname) could not be found"
like : aws configure
I'm using Python 3.4 and I want to use AWS CLI Keyring to encrypt my credentials..
This question is related to
python
amazon-web-services
credentials
aws-cli
In my case, I was using the Docker method for the AWS CLI tool, and I hadn't read the instructions far enough to realize that I had to make my credentials directory visible to the docker container. https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-docker.html
Instead of
docker run --rm -it amazon/aws-cli:latest command args...
I needed to do:
docker run --rm -it -v ~/.aws:/root/.aws amazon/aws-cli:latest command args...
Did you actually set up your specific user? The walkthrough setup guide in AWS explains how to set a default user, and then how to set up additional users. If you didn't complete the full setup, you'll just have a default block and your myName won't have been created..
can you check your config
file under ~/.aws/config
- you might have an invalid section called [myname], something like this (this is an example)
[default]
region=us-west-2
output=json
[myname]
region=us-east-1
output=text
Just remove the [myname] section (including all content for this profile) and you will be fine to run aws
cli again
For me it was because I had my .aws/config
file looking like this:
[profile myname]
aws_access_key_id = ....
aws_secret_access_key = ....
region=us-west-1
I think the reason is I based it off my .aws/credentials
file, which requires having [profile myname]
for Zappa and maybe some other aws/elastic beanstalk tools.
When I changed config
to this it worked great:
[myname]
aws_access_key_id = ....
aws_secret_access_key = ....
region=us-west-1
Make sure you are in the correct VirtualEnvironment. I updated PyCharm and for some reason had to point my project at my VE again. Opening the terminal, I was not in my VE when attempting zappa update (and got this error). Restarting PyCharm, all back to normal.
I ran into this problem when I moved to a new machine, carrying with me my AWS_DEFAULT_PROFILE environment variable, but not my ~/.aws directory. I couldn't get any awscli commands to work until I unset that variable or properly configured the named profile. But even the aws configure
command was broken, making things a bit tricky. Assuming you have a Unix-like shell handy:
env | grep AWS_
unset AWS_DEFAULT_PROFILE
aws --profile foo configure
exec $SHELL
aws iam get-user
Was facing similar issue and found below link more helpful then the answers provided here. I guess this is due to the updates to AWS CLI since the answers are provided.
https://serverfault.com/questions/792937/the-config-profile-adminuser-could-not-be-found
Essentially it helps to create two different files (i.e. one for the general config related information and the second for the credentials related information).
Use as follows
[profilename]
region=us-east-1
output=text
Example cmd
aws --profile myname CMD opts
Working with profiles is little tricky. Documentation can be found at: https://docs.aws.amazon.com/cli/latest/topic/config-vars.html (But you need to pay attention on env variables like AWS_PROFILE)
Using profile with aws cli requires a config file (default at ~/.aws/config
or set using AWS_CONFIG_FILE
).
A sample config file for reference:
`
[profile PROFILE_NAME]
output=json
region=us-west-1
aws_access_key_id=foo
aws_secret_access_key=bar
`
Env variable AWS_PROFILE
informs AWS cli about the profile to use from AWS config. It is not an alternate of config file like AWS_ACCESS_KEY_ID
/AWS_SECRET_ACCESS_KEY
are for ~/.aws/credentials
.
Another interesting fact is if AWS_PROFILE
is set and the AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
environment variables are set, then the credentials provided by AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
will override the credentials located in the profile provided by AWS_PROFILE
.
Source: Stackoverflow.com