Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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..

like image 782
Steve Ritz Avatar asked Dec 07 '15 13:12

Steve Ritz


People also ask

Can't find AWS credentials file?

The shared AWS config and credentials files are plaintext files that reside by default in a folder named . aws that is placed in the " home " folder on your computer. On Linux and macOS, this is typically shown as ~/. aws .

How do I add a profile to AWS config?

You can configure additional profiles by using aws configure with the --profile option, or by manually adding entries to the config and credentials files. For more information on the config and credentials files, see Configuration and credential file settings.

Where is my AWS config file?

The config file is located at ~/. aws/config on Linux or macOS, or at C:\Users\ USERNAME \. aws\config on Windows. This file contains the configuration settings for the default profile and any named profiles.

How do I find my profile name on AWS?

To get your access keys (consisting of an access key ID and secret access key), go to the IAM console at https://console.aws.amazon.com/iam/ . Choose Users from the navigation bar and then choose your AWS user name (not the check box). Choose the Security credentials tab, and then choose Create access key.


2 Answers

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"

like image 81
Stanley Yong Avatar answered Sep 20 '22 22:09

Stanley Yong


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 or AWS_PROFILE listed here, this answer is not applicable to you.
  • To temporarily remove the default profile: unset AWS_DEFAULT_PROFILE and/or unset AWS_PROFILE
  • To configure the profile in question: aws --profile foo configure
  • To reset the default profile variable: exec $SHELL
  • To test your new setup: aws iam get-user
like image 43
billkw Avatar answered Sep 21 '22 22:09

billkw