AWS : The config profile (MyName) could not be found

后端 未结 10 507
醉话见心
醉话见心 2021-02-01 11:52

Every time I want to config something with AWS I get the following error :

\"The config profile (myname) could not be found\"

like : aws confi

相关标签:
10条回答
  • 2021-02-01 12:10

    I think there is something missing from the AWS documentation in http://docs.aws.amazon.com/lambda/latest/dg/setup-awscli.html, it did not mention that you should edit the file ~/.aws/config to add your username profile. There are two ways to do this:

    1. edit ~/.aws/config or

    2. aws configure --profile "your username"

    0 讨论(0)
  • 2021-02-01 12:10

    In my case, I had the variable named "AWS_PROFILE" on Environment variables with an old value.

    0 讨论(0)
  • 2021-02-01 12:14

    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

    0 讨论(0)
  • 2021-02-01 12:18

    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.

    0 讨论(0)
  • 2021-02-01 12:20

    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:

    • To determine what AWS-specific variables you might have in your session: env | grep AWS_
      • if you don't see AWS_DEFAULT_PROFILE listed here, this answer is not applicable to you.
    • To temporarily remove the default profile: unset AWS_DEFAULT_PROFILE
    • To configure that default profile: aws --profile foo configure
    • To reset the default profile variable: exec $SHELL
    • To test your new setup: aws iam get-user
    0 讨论(0)
  • 2021-02-01 12:22

    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.

    0 讨论(0)
提交回复
热议问题