AWS profile not found

Hi,

I’m having trouble authenticating to AWS using a profile. My ~/.aws/credentials file has a profile named production:

`
[default]
aws_access_key_id = <some_key>
aws_secret_access_key = <some_secret>
region = eu-west-1

[production]
aws_access_key_id = <my_key>
aws_secret_access_key = <my_secret>
region = eu-west-1
`

Boto can see it:

`
import boto3

session = boto3.Session(profile_name=‘production’)
session.available_profiles

Out[7]:
[‘default’,
‘production’]
`

Yet while this playbook works fine:

`

  • name: example ec2 group
    ec2_group:
    name: example2
    description: an example EC2 group
    region: eu-west-1
    aws_secret_key: <my_key>
    aws_access_key: <my_secret>
    rules:
    `

this one errors:

`

  • name: example ec2 group
    ec2_group:
    name: example2
    description: an example EC2 group
    profile**: production**
    region: eu-west-1
    rules:
    `

An exception occurred during task execution. To see the full traceback, use -vvv. **The error was: boto.provider.ProfileNotFoundError: Profile "production" not found!**

Anyone seen this before? If ~/.aws/credentials isn’t being checked, what file is?

Many thanks.

Fixed. Had become: True in my build.yml so it was looking for root’s credentials file /root/.aws/credentials