Skip to content

Create a Heat stack

For this example, we use the template from the previous section.

Create the stack:

$ openstack stack create -t my_stack.yaml --parameter instance_name=my-vm  my_stack
+---------------------+-----------------------------------------------------+
| Field               | Value                                               |
+---------------------+-----------------------------------------------------+
| id                  | 8858e895-7747-4352-b850-a7fa3014e04b                |
| stack_name          | my_stack                                            |
| description         | Simple template to deploy a single compute instance |
| creation_time       | 2021-02-03T10:08:27Z                                |
| updated_time        | None                                                |
| stack_status        | CREATE_IN_PROGRESS                                  |
| stack_status_reason | Stack CREATE started                                |
+---------------------+-----------------------------------------------------+

Verify the stack has been created successfully:

$ openstack stack list
+--------------------------------------+------------+-----------------+----------------------+--------------+
| ID                                   | Stack Name | Stack Status    | Creation Time        | Updated Time |
+--------------------------------------+------------+-----------------+----------------------+--------------+
| 8858e895-7747-4352-b850-a7fa3014e04b | my_stack   | CREATE_COMPLETE | 2021-02-03T10:08:27Z | None         |
+--------------------------------------+------------+-----------------+----------------------+--------------+

We can see the resources associated with this stack:

$ openstack stack resource list my_stack
+---------------+--------------------------------------+------------------+-----------------+----------------------+
| resource_name | physical_resource_id                 | resource_type    | resource_status | updated_time         |
+---------------+--------------------------------------+------------------+-----------------+----------------------+
| heatinstance  | bbeca95a-4f55-4c28-a1a5-6099084c770a | OS::Nova::Server | CREATE_COMPLETE | 2021-02-03T10:08:27Z |
+---------------+--------------------------------------+------------------+-----------------+----------------------+

We can verify that this did, indeed, create a server:

$ openstack server list
+--------------------------------------+-------+--------+---------------------------------------------------------+---------------------------+-----------+
| ID                                   | Name  | Status | Networks                                                | Image                     | Flavor    |
+--------------------------------------+-------+--------+---------------------------------------------------------+---------------------------+-----------+
| bbeca95a-4f55-4d28-a1a5-6099084c770a | my-vm | ACTIVE | CERN_NETWORK=188.185.90.209, 2001:1458:d00:41::100:cd   | CC7 - x86_64 [2021-02-01] | m2.medium |
+--------------------------------------+-------+--------+---------------------------------------------------------+---------------------------+-----------+

Getting more information about the stack:

To get more information about a stack (for example, in case the creation fails), run

$ openstack stack show my_stack
+----------------------+-------------------------------------------------------+
| Field                | Value                                                 |
+----------------------+-------------------------------------------------------+
| id                   | 8858e895-7747-4352-b850-a7fa3014e04b                  |
| stack_name           | my_stack                                              |
| description          | Simple template to deploy a single compute instance   |
| creation_time        | 2021-02-03T10:08:27Z                                  |
| updated_time         | None                                                  |
| stack_status         | CREATE_FAILED                                         |
| stack_status_reason  | Resource CREATE failed: BadRequest: Instance name is  |
|                      | not a valid hostname (HTTP 400) (Request-ID: req-     |
|                      | 57c3ac77-9f8b-4d87-9587-a2279b111ad4)
<snip>
+----------------------+-------------------------------------------------------+