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

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


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"


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


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-2output=json[myname]region=us-east-1output=text

Just remove the [myname] section (including all content for this profile) and you will be fine to run aws cli again