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. This article will help you learn:
- How to list availability zones
- How to add an availability zone
- How to edit an existing availability zone
- How to delete an existing availability zone
- How to assign a machine to an availability zone
- How to allocate a machine in a particular zone
To see a list of availability zones, choose “AZs” from the top menu:
To create a zone, navigate to the ‘AZs’ page of the web UI and use the ‘Add AZ’ button. Enter a name for the zone and click ‘Add AZ’.
To edit a zone, on the ‘AZs’ page, select a zone and use the ‘Edit’ button:
This selection allows you to change the name and description for the added (or edited) zone:
To delete a zone, on the ‘AZs’ page, select a zone and use the ‘Delete AZ’ button. Doing so will also move any potential machine associations to the default zone.
To assign a machine to a zone, from the ‘Machines’ page, select a machine (or multiple machines) and choose ‘Set zone’ using the ‘Take action’ button:
After selecting a zone hit the ‘Set zone…’ button to apply the change.
You can also edit a machine’s ‘Configuration’ page to change its zone.
To see a list of availability zones, enter the following command:
maas $PROFILE zones read \ | jq -r '(["ZONE","NAME","DESCRIPTION"] | (., map(length*"-"))), (. | [.id, .name, .description]) | @tsv' | column -t
which produces output similar to:
ZONE NAME DESCRIPTION ---- ---- ----------- 5 BizOffice 1 default 4 Inventory 2 Medications 3 Payroll 6 ProServ
To create a zone, enter the following command:
maas $PROFILE zones create name=$ZONE_NAME description=$ZONE_DESCRIPTION
To edit a zone, enter a command similar to the following:
maas $PROFILE zone update $OLD_ZONE_NAME name=$NEW_ZONE_NAME \ description=$ZONE_DESCRIPTION
To delete a zone, enter a command like this:
maas $PROFILE zone delete $ZONE_NAME
To assign a machine to a zone, first retrieve the machine’s system ID like this:
maas PROFILE machines read | jq '. | .hostname, .system_id'
Then enter the following command, using the system ID you just retrieved:
maas admin machine update $SYSTEM_ID zone=$ZONE_NAME
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
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.