12

I am trying to run a python application on an Elastic Beanstalk which need to have permissions for the SQS and Dynamo DB.

I have created a profile under ~/.aws/config file like this:

[profile yolo]
aws_access_key_id = some-key
aws_secret_access_key = some-secret
region = some-region

and also started the elastic beanstalk like:

eb init --profile yolo

but when I check the logs online it states:

botocore.exceptions.ProfileNotFound: The config profile (yolo) could not be found

How do I get the boto3 to know this profile on elastic beanstalk environment?

Thanks.

nbtk
  • 3,039
  • 4
  • 21
  • 19

2 Answers2

4

You will also get this error if AWS_DEFAULT_PROFILE environment variable is set, but no config file is present.

Gudlaugur Egilsson
  • 2,420
  • 2
  • 24
  • 23
3

Try changing your .aws/config file header to - [yolo] instead of [profile yolo], and also separating the config and credentials to two files, as described in this link - http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html This should fix your problems.

Yaron Idan
  • 6,207
  • 5
  • 44
  • 66
  • 1
    the 'config' file must have the 'profile' prefix for each profile. However I'll try separating the credentials to the 'credentials' file and post here the results – nbtk Jul 17 '16 at 09:38
  • Quoting the page I've linked to - "*Important* The AWS credentials file uses a different naming format than the CLI config file for named profiles. Do not include the 'profile ' prefix when configuring a named profile in the AWS credentials file." – Yaron Idan Jul 17 '16 at 09:58
  • I was skeptic about your advice, but tried anyway - it didn't work. I moved the credentials to 'credentials' file under '[yolo]'. I called the profile under 'config' like '[yolo]' and '[profile yolo]', didn't solve. It makes sense: both files are stored locally. Nothing moves them to AWS. Unlike the files that are under '.ebextensions' an 'elasticbeanstalk' for example, which are environment-specific, the 'credentials' and 'config' files are global for all environments. If I had only one EC2 server, I would put both files there. But I can't do that when working on EB. – nbtk Jul 18 '16 at 21:11
  • I just had the same problem and removing `profile` from `[profile foo]` in `~/.aws/credentials` did the trick for me. I am now able to select the preferred set of credentials/profile using the methods indicated [here](http://stackoverflow.com/questions/33378422/how-to-chose-an-aws-profile-when-using-boto3-to-connect-to-cloudfront). – D. Woods Apr 02 '17 at 18:07
  • In my case, I had the same error, and I needed to *add* `profile` to the name of my profile in ~/.aws/config -- changing it from `[foo]` to `[profile foo]`. – Josh Apr 25 '23 at 20:18