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

后端 未结 10 532
醉话见心
醉话见心 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: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.

提交回复
热议问题