I have been trying to connect to AWS ec2 instance with ansible and as per the instructions from the ansible documentation I have placed my credentials in
~/.aws/credentials but somehow
botocore was not picking it up and I have spent at least 10 hours debugging this. Trying all the possible combinations in all the possible places where
ansible ec2 module will look for the credentials. But still could not find a solution.
So I placed the credentials directly into my ansible playbooks (which I didn’t want to do) just to get things running.
Now, after all the searches and reading what I have found is that the credential values to pass for
ENVIROMENT VARIABLES or in the playbook are named differently.
What I put in
~/.aws/credentials file was the following
The above credentials were not read by
boto3 python module.
Here is how I fixed the problem
[default] aws_access_key_id=ACCESS_KY_FROM_AWS_IAM aws_secret_access_key=SECRET_KEY_FROM_IAM
Notice the change in the variable name.