How to manage availability zones (deb/3.1/CLI)

2.9 3.0 3.1
DEB CLI ~ UI CLI ~ UI CLI ~ UI
SNAP CLI ~ UI CLI ~ UI CLI ~ UI

An availability zone is an organisational unit containing nodes, where each node is in exactly one zone. While in production, a machine can be allocated from a specific zone. Availability zones can be used for fault-tolerance, service performance, and power management. See Zone examples for more details.

A newly installed MAAS comes with a default zone which initially contains all nodes. You cannot remove the ‘default’ zone or change its name, but you can create new zones and assign machine to them. You can safely ignore this article if you’re not interested in leveraging zones.

Six questions you may have:

  1. How do I list availability zones?
  2. How do I add an availability zone?
  3. How do I edit an existing availability zone?
  4. How do I delete an existing availability zone?
  5. How do I assign a machine to an availability zone?
  6. How do I allocate a machine in a particular zone?

Allocate a machine in a zone

Allocating a machine in a particular zone can only be done via the MAAS CLI.

To deploy in a particular zone, call the acquire method in the region-controller API <region-controller-api> as before, but pass the zone parameter with the name of the zone. This method will allocate a machine in that zone, or fail with an HTTP 409 (“conflict”) error if the zone has no machines available that match your request.

Alternatively, you may want to request a machine that is not in a particular zone or one that is not in any of several zones. To do that, specify the not_in_zone parameter to acquire. This parameter takes a list of zone names; the allocated machine will not be in any of them. Again, if that leaves no machines available that match your request, the call will return a “conflict” error.

It is possible, though not usually useful, to combine the zone and not_in_zone parameters. If your choice for zone is also present in not_in_zone, no machine will ever match your request. Or if it’s not, then the not_in_zone values will not affect the result of the call at all.