[profile prod]
aws_access_key_id =
aws_secret_access_key =
You can then run ec2.py --profile prod to get the inventory for the prod account, although this option is not supported by ansible-playbook. You can also use the AWS_PROFILE variable - for example:
I am able to get all the inventory info when I tried like ./ec2.py --list --profile=prod
but whey I tried with AWS_PROFILE=prod ansible-playbook -i ec2.py myplaybook.yml to create new ec2 instance under prod account it says subnet/groups not found.
which means it’s checking under default profile not under prod account.