virtualenv SaltStack source SaltStack/bin/activate pip install salt pip install apache-libcloud pip install awscli pip install M2Crypto pip install pyzmqcreated a new user in AWS console using Identity Management console
testuser Access Key ID: ABCDEFGHIJKLMNO235M Secret Access Key: aVeBUeixIlt1ScfseCV344NMnrx4fecNnex9mNNmjyjWvNote: Above Key ID and Access Key are replaced with junk vales and will not work.
Above user “testuser” was added to AdministratorAccess policy in IAM (identity access management) in AWS console (Web interface).
In order to spin new instance and to be able to connect to them afterwards , we need a key pair. Either we can generate a new pair and upload it to AWS or generate it in AWS console (web interface) itself. In my case I had already generated the KeyPair. This key pair is called as “MyEC2Key”. This can be viewed under
“compute” -> “EC2” -> “Key Pair"
Now create a “Security Group” that will allow ssh.
aws ec2 create-security-group --group-name MySecurityGroupSSHOnly --description "Inbound SSH" aws ec2 authorize-security-group-ingress --group-name MySecurityGroupSSHOnly --cidr 0.0.0.0/0 --protocol tcp --port 22Become root on MacBook now:
mkdir /etc/salt touch /etc/salt/cloud.profiles touch /etc/salt/cloud.providers
cat /etc/salt/cloud.profiles
base_ec2_private:
provider: amazon_ireland_region
image: ami-9d23aeea
cat /etc/salt/cloud.providers
amazon_ireland_region:
id: ABCDEFGHIJKLMNO235M
key: aVeBUeixIlt1ScfseCV344NMnrx4fecNnex9mNNmjyjWv
keyname: MyEC2Key
private_key: /Users/MacUser/EC2/MyEC2Key.pem
location: eu-west-1
availability_zone: eu-west-1a
securitygroup: MySecurityGroupSSHOnly
size: t2.micro
del_root_vol_on_destroy: True
ssh_username: ec2-user
rename_on_destroy: True
ssh_interface: public_ips
provider: ec2
Launch Instance now:
source ~MacUser/PythonVirtENVs/SaltStack/bin/activate salt-cloud --profile=base_ec2_private First_Instance