Salt stack cloud infra

Salt Cloud to provide virtual machines of various cloud providers like Amazon AWS, Google Compute, etc. Salt Cloud is a generic interface to configure and manage VMs of various cloud providers.

*Cloud Config: The main configuration file for Salt Cloud is /etc/salt/cloud and it applies to all the VMs. The main configuration file is called Cloud Config.

*Cloud Providers: To target specific cloud providers, we can use specific configuration files and they are located in /etc/salt/cloud.providers.d/*.conf

*Cloud Profiles: To target a specific VM, we can also use a special configuration file, which applies to that particular VM only and they are located at /etc/salt/cloud.profiles.d/*.conf, these are called Cloud Profiles

For a virtual machine, settings in the Cloud Config are applied first and then in the Cloud Providers, and finally, override is done by the Cloud Profiles.

Installation of Salt Cloud

By default, Salt Cloud is built into the Salt and is readily available. If it is not available, we can install it by using the command below.

#pip install salt-cloud

Provisioning a Virtual Machine

To provision a virtual machine, we need to define a cloud provider and a cloud profile. Once both are created, we can provision a new virtual machine for using it.

Cloud Provider

Cloud host information is configured in the Cloud provider configuration file. Normally, the basic pieces of information which need to be configured are cloud driver, username, password, private key, etc.

Create a file, my-amazon-cloud.conf under /etc/salt/cloud.providers.d/

Add a new provider using the ec2 driver.


driver: ec2

id: ''

key: ''

private_key: /path/to/privatekey.pem


securitygroup: default



Once the cloud providers are configured, we can query the available location of the provider, available machine images, and its various sizes

#salt-cloud --list-location my-amazon-cloud

#salt-cloud --list-images my-amazon-cloud

#salt-cloud --list-sizes my-amazon-cloud

Cloud Profile

A Cloud profile specifies the virtual machine image and size. It can be configured under – /etc/salt/cloud.profiles.d/. Let us create a simple profile

#cat simple.conf


provider: my-amazon-cloud



Virtual Machine

Once the provider and profiles are configured, we can easily provide a virtual machine using the salt cloud as shown below.

#salt-cloud -p aws_micro master minion minion1

Where, p – Profile name master, minion, and minion1 are the new virtual machines.

The details of the newly created virtual machine can be obtained by using the following command.

#salt-cloud --query

Cloud Map

A Cloud Map is a special format to create multiple virtual machines at once. The map file format is to specify the profile and then add a list of the virtual machines under it.

sample map


- web1

- web2


- db1

- db2

The map file can be passed as an argument to the salt-cloud command to create the virtual machine

Recent Comments

No comments

Leave a Comment