I have created small study aws infrastructure to learn SaltStack. There are three ec2 instances already running. (Master and two Minions). One minion is iam-role-less, one minion has role that enables him to access ec2 and s3 actions. (Roles settings purely for testing purposes.)
What I am trying to discover is how to configure salt-master (or salt-minion?) so it has access to aws services. For now, I can access the second minion with SSH and using boto3 i have acess to the ec2 and ss3. But if I use boto_ec2 execution module from salt-master => salt-minion, access error occur. I know that there is /etc/salt/cloud.providers and /etc/salt/cloud.profiles configuration that should be used. Most examples I saw were expecting that salt-minions will be created by salt, so I am a bit confused how to do it with pre-existing instances.
So the question is: "What is the right and correct way to configure master and minions to be able to use boto_ec2 module (or any other) from salt-master and orchestrate minions. Where and how should AWS credentials (keys) be set? Which config files has to be modified/added, what commands has to be run? Instances are already up."
I have found this link: https://salt-cloud.readthedocs.org/en/latest/topics/aws.html but there are places, where it says:
"The following settings are always required for EC2:"
# Set the EC2 login data
my-ec2-config:
id: HJGRYCILJLKJYG
key: 'kdjgfsgm;woormgl/aserigjksjdhasdfgn'
keyname: test
securitygroup: quick-start
private_key: /root/test.pem
provider: ec2
But it is not said where this config should be. On master/minion? Which file? And when I run the command:
# salt '*142*' boto_ec2.exists Master
: 'boto_ec2' __virtual__ returned False
ERROR: Minions returned with non-zero exit code
it's not working.