How to create a set of VMs using OpenStack Heat (Orchestration)

Heat is an OpenStack component responsible for Orchestration. Its purpose is to deliver automation engine and optimize processes.
Heat uses templates in most-popular for DevOps culture syntax → yaml. These templates describe the whole infrastructure that you are able to deploy. The deployed environment is being called a stack. It can consist of many different resources.

You can leverage Heat templates using python-heatclient in CLI or using Horizon dashboard in the web browser.


For installing python-heatclient run pip command (strongly recommended virtual environment activated):

To run a prepared template in order to deploy a stack, you have to use this command:


Log in to the Horizon dashboard and choose Orchestration tab.


Click on the Stacks.


Navigate to the right part of the screen and choose “Launch Stack”.


Enroll Template Source selector and choose a particular file, Direct Input or URL to your template.

Basic template

Using this snippet, you can create one virtual machine, booted from an ephemeral disk.


heat_template_version → strictly a version of heat template. Each of them varies in many ways (including different modules support, more parameters customization etc.)

resources → entry to commence providing particular components for deployment

instance → name of the resource (you can type in anything on your own)

type → definition of an OpenStack component (a comprehensive list: https://docs.openstack.org/heat/latest/template_guide/openstack.html)

properties → under this tab provide required parameters for deploying a component (in the case of a virtual machine such as flavor, image networks etc.)

Please, customize the filled-in values for your project purposes.

Check if you are using tabs for indentation. YAML doesn’t allow tabs; it requires spaces.


More advanced template

In this example, we will attach parameters, ResourceGroup with counter, VM booted from Cinder Volume and predefined outputs.

As you can see,  firstly you have to create a real volume (called VOL_FAQ). After that, you can proceed to create a VM (With_volume).


Parameters →  a solution to provide default values, which you can later inject into resource definitions using {get param: param_name }

ResourceGroup → component being used for repeating deployment, e.g two identical VM’s

Count → defines a variable for iterative operations

resource_def → starting statement for defining group resources

%index% → in this way we can easily add an iterative number to the VM name, increasing values starting from 0.

block_device_mapping → property to define a bootable Cinder volume for instance

outputs → Additional information concerning deployed elements of the stack. In this case, it returns a “show” attribute output. You can examine this kind of information by using openstack stack output list. Available attributes for every component can be found here: https://docs.openstack.org/heat/latest/template_guide/openstack.html

Please, customize the filled-in values for your project purposes.





Was this article helpful?