How to Make Availability Zones in OpenStack from Linux Command Line?

In the terminology of OpenStack, Availability Zones is known as the logical partition of network service (Neutron), block storage (Cinder) and compute (Nova). The main task of Availability Zones is to do a grouping of the workload of settings. These settings include both non-production and production.

In this article, we are going to show how you can make and use availability zones in OpenStack through the Linux command line.

How to Make Availability Zones in OpenStack from Linux Command Line?

At the time when you will deploy OpenStack, then compute (Nova) will be created automatically. It is a default Availability Zone. Nova AZ includes all compute nodes.

  1. If you want to check the list of Availability Zones then you have to run the following command line of OpenStack.
~# source openrc
~# openstack availability zone list
  1. In case, you want to run Availability Zones of compute then you have to run the below command line of OpenStack. Check it out:
~# openstack availability zone list –compute
  1. To check the compute hosts that are mapped to Availability Zones of compute, you need to execute the following command line.
~# openstack host list | grep -E "Zone|nova”
  1. Now, we have to create two groups of host-aggregate. The name of one host-aggregate will be non-production and the other one will have a name of production. It is time to add compute- 7, 8 & 9 to the non-production group and compute- 4, 5 & 6 to the production group. You have to use the OpenStack commands mentioned below:
~# openstack aggregate create non-production
~# openstack aggregate create production
  1. At the moment, you need to make the Availability Zones and link them to their particular groups.
# openstack aggregate set –zone <az_name>  <host_aggregate_name>
  1. Last, you need to add the compute host to its group of host-aggregate.
# openstack aggregate add host <host_aggregate_name>  <compute_host>
  1. In the same way, you have to add compute host to a non-production group of host-aggregate.
~# openstack aggregate add host non-production compute-0-7
~# openstack aggregate add host non-production compute-0-8
~# openstack aggregate add host non-production compute-0-9
  1. At this time, you need to execute the following Linux command line to check the Availability Zones and host-aggregate groups.
~# openstack aggregate list
  1. You need to run the following commands to check the list of compute linked with Availability Zones and groups of host-aggregate.
~# openstack aggregate show production
~# openstack aggregate show non-production

The above command output will show you that you have successfully made the Availability Zones in OpenStack from the Linux command line.

Create Virtual Machines in Availability Zones

After making the Availability Zones, you can create diverse virtual machines in two availability zones.

  1. To make a virtual machine in one specific AZ, you need to use the following command:
    ~# openstack server create –flavor <flavor-name> –image <Image-Name-Or-Image-ID>  –nic net-id=<Network-ID> –security-group <Security-Group-ID> –key-name <Keypair-Name> –availability-zone <AZ-Name>   <VM-Name>
  2. The example of this command is as follows:
    ~# openstack server create --flavor m1.small --image Cirros --nic net-id=37b9ab9a-f198-4db1-a5d6- S789b0Sbfb4c --security-group f8dda7?c3-f£7c3-423b-923a-2b21fe0bbf3c --key-name mykey --availability-zone production-az test-vm-prod-az
  3. To know about the virtual machine in detail, you need to run the following Linux command line.
    ~# openstack server show test-vm-prod-az
  4. If you want to make a virtual machine in a particular compute node then it is not a problem! All you have to do is to use the following Linux command line:
    ~# openstack server create –flavor <flavor-name> –image <Image-Name-Or-Image-ID>  –nic net-id=<Network-ID> –security-group <Security-Group-ID> –key-name {Keypair-Name} –availability-zone <AZ-Name>:<Compute-Host> <VM-Name>
  5. For example, we have to spin a virtual machine in the production Availability Zone of particular compute 0-6. To make it successful, we need to use the following command line:
    ~# openstack server create --flavor m1.small --image Cirros --nic net-id=37b9ab9a-f198-4db1-a5d6-S789b0Sbfb4c --security-group f8dda7?c3-f£7c3-423b-923a-2b21fe0bbf3c --key-name mykey --availability-zone production-az:compute-0-6 test-vm-prod-az-host
  6. To check the details of the virtual machine again, you have to execute the Linux command line specified below:
    ~# openstack server show test-vm-prod-az-host
  7. When you will execute the above command line then you will get the following output:
  8. Likewise, we can make virtual machines in the non-production Availability Zones. Have a look at the following example:
    ~# openstack server create --flavor m1.small --image Cirros --nic net-id=37b9ab9a-f198-4db1-a5d6- S789b0Sbfb4c --security-group f8dda7?c3-f£7c3-423b-923a-2b21fe0bbf3c --key-name mykey --availability-zone non-production-az vm-nonprod-az
  9. Check the details of the virtual machine by using the following command.
    ~# openstack server show vm-nonprod-az
  10. After executing the above command, you will get the output like the following.

Kevin Arrows


Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Make Availability Zones in OpenStack from Linux Command Line?

If the issue is with your Computer or a Laptop you should try using Reimage Plus which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Reimage by clicking the Download button below.

Download Now

I'm not interested

Close